Dos 如何与 WINDOWS 的SOCKET 连接?(200分)

  • 主题发起人 主题发起人 w_xinyu
  • 开始时间 开始时间
W

w_xinyu

Unregistered / Unconfirmed
GUEST, unregistred user!
各位大虾:
我手头有这样一个工作:上端是windwos 系统,应用软件用 delphi 下的win socket 编程;而下端是DOS系统,用C语言编程,且只有标准网卡驱动(ne2000).请问在下端如何用C编写网络程序与windows的sochet 通信!
事关饭碗,请各位大虾速来救命!
 
大多数资料介绍的是用Config中加入InterLnk来实现的Novel网,此时的机器是
作为硬盘共享来实现的互连。NE2000下有DOS的驱动及引导程序,如IPX、NET3X等
但如何编程调用网卡,未见有关的资料。
解决的办法,将DOS下的机器作为Windows95的对等网的映射硬盘使用,是否能解决
你的问题?
 
好象是可以,不过一下忘了是在哪看到它的详细资料了;(

大家也帮忙找找吧。
 
sorry! 由于我出差一段时间,所以很久没有上网,请大家原谅!
不过,关于我提的问题好象没有什么好的答案,
难道没有一位大虾研究过这个问题吗?
 
过了一年,还是没有人研究过这个问题吗?请版主帮忙呼吁一下,让各位高手帮我
解决这个问题!
 
socket通讯与系统环境无关,直接按标准的C 编写socket的规范写就是了,dos下当然可以
(windows下的dos窗),如果是纯dos,需先安装相应socket支持才行.
Socket编程也是个比较庞大的内容,不是这样一下就可以说清的.可以自己买本书看看.
 
我用DOS下的PACKET DRIVER写过和WINSOCK的通讯程序,
由于实现TCP过于复杂,我用的是UDP协议,
从NE2000的网卡驱动写起、到物理帧、以后的IP包、SOCKET接口全部有,而且已经实际
用了几年了
不过DOS下用的是BP7.0,如有兴趣可以交流一下
 
呵呵,才查到这个贴子,请网疯指教一二——源码可以公开吗?
……首先吧:packet driver是什么东西?
 
to iie:
现在源码已经是我们公司的了,所以就不能公开了。
关于PACKET DRIVER 看看下面的摘录的一段

Packet Drivers, made simple 9 Jan 1990

by Joe R. Doupnik, Utah State University
jrd@usu.Bitnet, jrd@cc.usu.edu 129.123.1.1

for Novell Technology Transfer Partnership


The problem:

Ethernet is a common, or the most common, large organization method
of networking systems. To date, the many programs (applications) designed to
talk across Ethernet all have built-in drivers for particular Ethernet boards.

That means that each application owns the Ethernet board and other
applications cannot use it simultaneously. Goodbye Novell file server(s) if
TCP/IP is needed.

That also has meant that different applications have not used a common
pool of Ethernet boards and the user may have to install two of them, if that
is possible on many PCs. Expensive and a real pain for system maintainers.

Changing applications means reconfiguring the PC and then rebooting.


The solution:

Suppose some small piece of software owned the Ethernet board and
provided a standard interface to all software packages. That would give
standardization for the applications, and require only one board per PC.

Further suppose this small item, named a Packet Driver, allowed
applications to register themselves by saying to the P.D. -

Pac baby:
I want packets of the following kind(s) and when you see one like
that call me at this address, immediately. (801) 555-1212.
Sincerly,
Big App

Or even the reverse if the application is packing up shop and quiting.

This second part allows multiple applications to come and go while
the tiny Packet Driver remains in memory; it uses just a few Kbytes. And it
allows several applications to register for different kinds of packets. Each
application remains ignorant of traffic not destined for itself.

Applications have to be built to use the Packet Driver interface
rather than wanting an Ethernet board to themselves. They are now being
written that way.









Packet Drivers, made simple 2-3


Ethernet packet construction

a packet, 64 to ~1000 bytes
---------------------------------------------------------------
| preamble.. | from address | to address | TYPE | ...data.... |
---------------------------------------------------------------
6 bytes 6 bytes 2 bytes many bytes

Regular Ethernet uses the TYPE field to hold a number which is the
kind of protocol. Novell's TYPE is 8137.

IEEE 802.3 Ethernet (much less popular) uses that field to count
the number of bytes that follow, even though the Ethernet board itself
provides that information. Thus, software must look in the data field to
locate any protocol kind, and that will cost time and impose a load on
machines.

The TO address refers to an Ethernet hardware address, normally that
set into the board by the manufacturer and hence unique in the world. But, a
big headache is that address can be one to be received by several places or
by all places (Multicast or Broadcast). Broadcast traffic hits every single
board in the place. TCP and NFS and Unix systems love to broadcast, a lot.

Packet Driver concept, from FTP Software Inc.
-------------------- /======= coax ========>
| Ethernet board |- T
-------------------- /======= coax ========>
|
-----------------------------------------------------------------
Packet Driver == Owner of the Board
Board interrupts Packet Driver, saying "Got another pkt for you".
Get TYPE from board's packet buffer.
Scan list of requestors to find match of TYPE and requestor's Type.
If a match pass packet to requestor, clears board for next packet.
If no match discard packet, clears board for next packet.
------------------------------------------------------------------
| | | ... |
NetWare TCP/IP NFS other requestors

Advantages:
1) Run multiple applications across the same board, simultaneously if req'd.
Each registers and can deregister itself with the Packet Driver.
2) One board fits all, no buying different boards for different applications.
Current boards: WD8003E, 3C501, 3C503, 3C523, NI5010, NI5210, DLINK,
(NE-1000 running at USU), and more directly from vendors. Recommend the
WD8003E, then the 3C503. The NE-1000 is similar to both.
3) Much faster filtering of "junk" packets, particularly and especially
Broadcast and Multicast packets found on heavily used networks.
4) Consequence of 3) the PC uses far fewer cpu cycles servicing the network.
5) No more reconfiguring and rebooting to change applications.
6) Connect to a Novell File Server (or servers) and still run TCP/IP or
PC-NFS or ... with the Novell systems remaining active and available for
file serving and printing.
7) Thus the Packet Driver acts as a fast smart secretary, bothering clients
only when packets arrive specifically for them. If an application has
slow or weak code for handling packets then the P.D. is a boon.
9) Packet Driver size is very small and the P.D. + Novell Shell (IPX + NETx)
is very nearly the same size as without a Packet Driver.
10) TYPE 8137 is REQUIRED by NetWare/VMS, no way around it.









Packet Drivers, made simple 3-3

Other comments and opinions:
11) Alas, my experience is that ordinary Novell 2.1x File Servers are unable
to cohabit a heavily used campus backbone for some kinds of boards. But
converting the server to use Regular Ethernet packets with TYPE 8137
allows them to very rapidly discard unwanted pkts and live happily for
weeks on end attached to a main backbone. Whew!
12) BYU and Novell have made life easy for us by providing the ECONFIG.EXE
utility to convert file servers to TYPE 8137 and even to change shells
to the same system. It's reversable too. Apply to NET$OS.EX1, and to
IPX.COM (but only if not using Packet Drivers, else build IPX for PD).
13) FTP Software Inc has made life easy for us by providing the Packet Driver
specification and making it public.
14) Ethernet board vendors are rapidly supplying Packet Drivers for their
products. Hot stuff this year. From the user's side all P.D.'s are
supposed to look alike; things are improving in this regard.
15) New Packet Drivers are being developed by individuals and are available
at no cost across the networks. The central distribution point is
Crynwr Software, Russ Nelson, nelson@crynwr.com.



不过这年头写DOS程序的人好象是不多了,人都是急功近利的...
 
netwind: Thanks a lot. I am checking that webpage.
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部