Windows Sockets == winsock
Documentation available at
Windows Sockets spec. defines a network programming interface to Microsoft Windows which is based on the "socket" paradigm.
Winsock was designed by a committee.
A standard API for all Windows TCP/IP programs.
Windows DLL
Each vendor supplies its own WINSOCK.DLL
The DLL has to provide only the interface.
Actual network code can reside elsewhere.
Trumpet uses a windows program which is started by WINSOCK.DLL
PCTCP uses a network stack which is loaded at boot time.
Winsock provides all of the "standard" Berkeley socket calls.
Additional functions were added for effiency reasons.
Only new mandatory calls:
Problems with Berkeley sockets under Windows:
Asynchornous versions of blocking Berkeley socket calls:
Database lookup calls:
Berkeley Windows gethostbyaddr() WSAAsyncGetHostByAddr() gethostbyname() WSAAsyncGetHostByName() getprotobyname() WSAAsyncGetProtoByName() getprotobynumber() WSAAsyncGetProtoByNumber() getservbyname() WSAAsyncGetServByName() getservbyport() WSAAsyncGetServByPort()
Other Windows-specific calls:
SOCKET type
Typical BSD:
s = socket(...); if (s == -1) { ... }
Winsock:
s = socket(...); if (s == INVALID_SOCKET) { ... }
fd_set is NOT a bit-array under winsock.
MUST use FD_XXX calls (not macros...)
errno can lie!
Typical BSD:
r = recv(...); if (r == -1 && errno == EWOULDBLOCK) {...}
Winsock:
r = recv(...); if (r == -1 && WSAGetLastError() == EWOULDBLOCK) {...}
HANDLE PASCAL FAR WSAAsyncGetHostByAddr( HWND hWnd, unsigned int wMsg, const char FAR *addr, int len, int type, char FAR *buf, int buflen);