![Page 1: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/1.jpg)
NUCLEUS Electronics Corp.
DSock – DOS TCP/IPby ICOP / DMP Group
DSockDSock –– DOS TCP/IPDOS TCP/IPby ICOP / DMP Groupby ICOP / DMP Group
![Page 2: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/2.jpg)
NUCLEUS Electronics Corp.
What is WinSock?What is WinSock?What is WinSock?• The Windows Sockets specification defines a network
programming interface for Microsoft Windows which is based on the "socket" paradigm popularized in the Berkeley Software Distribution (BSD) from the University of California at Berkeley.
• Released at 1993 of Windows Sockets 1.1• An open interface for network programming under Microsoft
Windows version 1.1• Application programming interface – API
• WinSock.dll (Windows Sockets)• WinSock is a Windows TCP/IP library for users who want to
program their network application software under Windows.
![Page 3: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/3.jpg)
NUCLEUS Electronics Corp.
Structure of WinSockStructure of WinSockStructure of WinSockUser
Ethernet
Application
Ethernet
Application
WindowsWindows
WinSock
TCP/IP
Hardware
WinSock
![Page 4: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/4.jpg)
NUCLEUS Electronics Corp.
What is DSock?What is What is DSockDSock??• Based on the platform of DoD Model
• DoD – Department of Defense
• DSock.lib (DMP DOS Sockets)
• Issued by DMP group at 1998• DSocks is a DOS TCP/IP library for users who want to
program their application software through network interface under DOS.
• It provides C function calls for programmers to create internet applications.
![Page 5: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/5.jpg)
NUCLEUS Electronics Corp.
Structure of DSock on DOS EnvironmentStructure of Structure of DSockDSock on DOS Environmenton DOS Environment
Network Interface
DSocksLibrary
PacketDriver
DOS
Application (NET) User
Hardware
TCP/IP
![Page 6: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/6.jpg)
NUCLEUS Electronics Corp.
Conditions to Use DSock?Conditions to Use Conditions to Use DSockDSock??• Hardware Requirements
• ICOP Single Board Computers with Ethernet interface only• Realtek 8019 10 Base-T• Realtek 8139 10/100 Base-T
• Driver Requirements• Packet Drivers for RTL8019 and RTL8139 are necessary
• RTL8019: NE2000 compatible• RTL8139: Support by Realtek
• Operating System• MS-DOS / Dr-DOS• X-DOS
![Page 7: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/7.jpg)
NUCLEUS Electronics Corp.
Structure of DSock LibraryStructure of DSock Library
![Page 8: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/8.jpg)
NUCLEUS Electronics Corp.
OSI Reference Model & TCP/IPOSI Reference Model & TCP/IPOSI Reference Model & TCP/IP
Application
Presentation
Session
Transport
Network
Data Link
Physical
Telnet FTP SMTP
TCP UDP
IP ICMP, ARP, OSPF, RIP
Logical Link Control Media Access Control
7 Layer of Open System
Interconnection Model
More …
..
5 Layer of TCP/IP Protocol M
odel
![Page 9: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/9.jpg)
NUCLEUS Electronics Corp.
OSI Reference Model & DSockOSI Reference Model & OSI Reference Model & DSockDSock
Application
Presentation
Session
Transport
Network
Data Link
Physical
TCP UDP
IP ICMP, ARP
Packet DriverTelnet
FTP
HTTP
SMTP
DN
S
BO
OTP/D
HC
P
4 Layer of DoD
(Departm
ent of Defense) M
odel
![Page 10: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/10.jpg)
NUCLEUS Electronics Corp.
Function Call of Dsock LibraryFunction Call of Function Call of DsockDsock LibraryLibrary
Function Call for C
LanguageTCP UDP
IP ICMP, ARP
Packet Driver
DSock.lib
4 Layer of DoD
(Departm
ent of Defense) M
odel
Telnet
FTP
HTTP
SMTP
DN
S
BO
OTP/D
HC
P
![Page 11: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/11.jpg)
NUCLEUS Electronics Corp.
Function Call of DSock LibraryFunction Call of DSock Library
![Page 12: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/12.jpg)
NUCLEUS Electronics Corp.
Function Call of WinSock- 1/3Function Call of WinSockFunction Call of WinSock-- 1/31/3
• Socket Functions (BSD 4.3-like)
• accept() bind() closesocket()• connect() getpeername() getsockname()• getsockopt() htonl() htons()• inet_addr() inet_ntoa() ioctlsocket()• listen() ntohl() ntohs()• recv()* recvfrom()* select()*• send()* sendto()* setsockopt()• shutdown() socket()
• Note: * The routine can block if acting on a blocking socket.
![Page 13: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/13.jpg)
NUCLEUS Electronics Corp.
Function Call of WinSock - 2/3Function Call of WinSock Function Call of WinSock -- 2/32/3
• Database Functions (BSD 4.3-like)
• gethostbyaddr()*• gethostname()• gethostbyname()*• getprotobyname()*• getprotobynumber()*• getservbyname()*• getservbyport()*
• Note: * The routine can block under some circumstances.
![Page 14: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/14.jpg)
NUCLEUS Electronics Corp.
Function Call of WinSock - 3/3Function Call of WinSock Function Call of WinSock -- 3/33/3
• Microsoft Windows-specific Extensions
• WSAAsyncGetHostByAddr() WSAAsyncGetHostByName()• WSAAsyncGetProtoByName() WSAAsyncGetProtoByNumber()• WSAAsyncGetServByName() WSAAsyncGetServByPort()• WSAAsyncSelect() WSACancelAsyncRequest()• WSACancelBlockingCall() WSACleanup()• WSAGetLastError() WSAIsBlocking()• WSASetBlockingHook() WSASetLastError()• WSAStartup() WSAUnhookBlockingHook()
![Page 15: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/15.jpg)
NUCLEUS Electronics Corp.
Function Call of DSock- 1/3Function Call of Function Call of DSockDSock-- 1/31/3
• Socket Functions (WinSock-like)
• accept() SocketAccept()• bind() SocketBind()• closesocket() SocketClose()• connect() SocketConnect()• htonl() htonl()• htons() htons()• inet_addr() inet_addr()• inet_ntoa() inet_ntoa() • listen() SocketListen()• ntohl() ntohl()• ntohs() ntohs()
WinSock
DSock
![Page 16: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/16.jpg)
NUCLEUS Electronics Corp.
Function Call of DSock- 2/3Function Call of Function Call of DSockDSock-- 2/32/3
• Socket Functions (WinSock-like)
• recv() SocketRecv()• recvfrom() SocketRecvFrom()• send() SocketSend()• sendto() SocketSendTo()• socket() SocketCreate()• WSAStartup() DSock_Open()• WSACleanup() DSock_Close()
WinSock
DSock
![Page 17: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/17.jpg)
NUCLEUS Electronics Corp.
Function Call of DSock - 3/3Function Call of Function Call of DSockDSock -- 3/33/3
• DSock-specific Extensions
• DSock_DoBootp() DSock_LoadConfigFile()• DSock_AddGateway() DSock_GetGateway()• DSock_Resolve DSock_GetMacAddr()• DSock_GetHostIp() DSock_SetHostIp()• DSock_GetNetMask() DSock_SetNetMask()• SocketDestory() SocketAbort()• SocketDataReady() SocketIsConnected()• SocketPutChar() SocketGetChar()• SocketPutString() SocketGetString()• DSock_AddDomainNameServer()• DSock_GetDomainNameServer()
![Page 18: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/18.jpg)
NUCLEUS Electronics Corp.
Procedure of TCP Server-Client ModelProcedure of TCP ServerProcedure of TCP Server--Client ModelClient Model
DSock_Open()
SocketCreate()
SocketBind()SocketListen()
SocketAccept()
SocketSend()
SocketClose()SocketDestory()
DSock_Close()
DSock_Open()
SocketCreate()
SocketConnect()
SocketRecv()
SocketClose()SocketDestory()
DSock_Close()
Server
Client
connection
![Page 19: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/19.jpg)
NUCLEUS Electronics Corp.
Procedure of UDP Server-Client ModelProcedure of UDP ServerProcedure of UDP Server--Client ModelClient Model
DSock_Open()
SocketCreate()
SocketRecvFrom()
SocketClose()SocketDestory()
DSock_Close()
Server
Client
SocketBind()
DSock_Open()
SocketCreate()
SocketSendTo()
SocketClose()SocketDestory()
DSock_Close()
SocketBind()
![Page 20: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/20.jpg)
NUCLEUS Electronics Corp.
Demo Program of DSockDemo Program of DSock
![Page 21: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/21.jpg)
NUCLEUS Electronics Corp.
Demo Program of DSockDemo Program of Demo Program of DSockDSock
• BOOTP Demo program of BOOTP/DHCP.• DNS To get IP address of domain name.• EXE Exectue files for all samples.• FTPD Demo program of FTP server.• HTTPD Demo program of Web server.• SMTP A simple program to send mail.• TALK_TCP Example of Talk with TCP.• TALK_UDP Example of Talk with UDP (broadcast).• TELNETD Simple TELNET server example.• talk_tcp_win Talk with TCP (Windows version by WinSock).• talk_udp_win Talk with UDP (Windows version by WinSock).
Filename Description
![Page 22: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/22.jpg)
NUCLEUS Electronics Corp.
Example of DSock to DSockExample of Example of DSockDSock to to DSockDSock
Ethernet
DSockLibrary
PacketDriver
TALK_TCP
DO
S
Ethernet
DSockLibrary
PacketDriver
TALK_TCP
DO
S
TCP/IP
![Page 23: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/23.jpg)
NUCLEUS Electronics Corp.
Example of DSock to WinSockExample of Example of DSockDSock to WinSockto WinSock
Ethernet
DSockLibrary
PacketDriver
TALK_UDP
DO
S
Ethernet
talk__udp_win
WinSock
Windows
TCP/IP
![Page 24: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/24.jpg)
NUCLEUS Electronics Corp.
Example of DSock ServersExample of Example of DSockDSock ServersServers
Ethernet
DSockLibrary
PacketDriver
FTPD
DO
S
TCP/IP
Ethernet
DSockLibrary
PacketDriver
HTTPD
DO
S
Ethernet
DSockLibrary
PacketDriver
TELNETD
DO
S
Client
![Page 25: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/25.jpg)
NUCLEUS Electronics Corp.
Why DSock?Why DSock?
![Page 26: DSock - DOS TCP/IPusers.telenet.be/mydotcom///download/tcpip/dsock2.pdf · NUCLEUS Electronics Corp. Structure of WinSockStructure of WinSock. User. Ethernet Application Ethernet](https://reader033.vdocument.in/reader033/viewer/2022060221/5f0767ba7e708231d41cd246/html5/thumbnails/26.jpg)
NUCLEUS Electronics Corp.
Advantages of DOS TCP/IPAdvantages of DOS TCP/IPAdvantages of DOS TCP/IP• Running under dedicate operating system – DOS
• 100% dedicate for single tasking• Complete development tools for x86 and DOS
• C compiler• Debug tools
• Easy to up-to-date• Fast time-to-market• Lowest cost of TCP/IP solution
(Compare with simple work under Windows system)• Small size and low cost of storage for software
• Can store in a 512k single chip flash disk