by Chin-Shiuh Shieh on
| BSD Socket API | Winsocket Extended API | Functionality |
|---|---|---|
| accept | WSAAccept | Let listening socket accepts connection request from remote socket and establish the connection. |
| bind | Set local socket's IP address and port number. | |
| closesocket | Close connection and socket, and release system resource. | |
| connect | WSAConnect | Establish connect to a remote socket. |
| getpeername | Get remote socket's IP address and port number. | |
| getsockname | Get local socket's IP address and port number. | |
| getsocketopt | Get socket's options. | |
| ioctlsocket | Set or get socket's parameters. | |
| listen | Let socket listen to incoming request. | |
| recv | WSARecv | Receive data from socket. |
| recvfrom | WSARecvFrom | Receive data and source information. |
| select | Set socket's read/write status and execute synchrnous I/O. | |
| WSASelect | Set socket's read/write status and execute asynchrnous I/O. | |
| send | WSASend | Send data to connected socket. |
| sendto | WSASendTo | Send data to specified IP address/Port number. |
| setsockopt | Set socket's options. | |
| shutdown | Disable socket's send and receive. | |
| socket | WSASocket | Create socket. |
| BSD Socket API | Winsocket Extended API | Functionality (Winsock Control Related) |
| WSACleanup | Terminate use of the Windows Sockets DLL. | |
| WSADuplicateSocket | Return a WSAPROTOCOL_INFO structure that can be used to create a new socket descriptor for a shared socket. | |
| WSAEnumProtocols | Get information about available transport protocols. | |
| WSAGetLastError | Get the error status for the last operation which failed. | |
| WSASetLastError | Set the error code which can be retrieved through the WSAGetLastError function. | |
| WSAStartup | Initiate use of the Windows Sockets DLL by a process. | |
| BSD Socket API | Winsocket Extended API | Functionality (Windows Event Related) |
| WSACloseEnevt | Close an open event object. | |
| WSACreateEvent | Create a new event object. | |
| WSAEnumNetworkEvents | Discover occurrences of network events for the indicated socket. | |
| WSAResetEvent | Reset the state of the specified event object to nonsignaled. | |
| WSASetEvent | Set the state of the specified event object to signaled. | |
| WSAWaitForMultipleEvents | Return either when one or all of the specified event objects are in the signaled state, or when the time-out interval expires. | |
| BSD Socket API | Winsocket Extended API | Functionality (Conversion API) |
| htonl | WSAHtonl | Convert an u_long from host to TCP/IP network byte order. |
| htons | WSAHtons | Convert an u_short from host to TCP/IP network byte order. |
| ntohl | WSANtohl | Convert an u_long from TCP/IP network order to host byte order. |
| ntohs | WSANtohs | Convert an u_short from TCP/IP network byte order to host byte order. |
| inet_addr | Convert a string containing an Internet Protocol dotted address into an in_addr. | |
| inet_ntoa | Convert a network address into a string in dotted format. | |
| BSD Socket API | Winsocket Extended API | Functionality (Database(DNS) API) |
| gethostbyaddr | Get host information corresponding to an address. | |
| gethostbyname | Get host information corresponding to a hostname. | |
| gethostname | Return the standard host name for the local machine. | |
| getprotobyname | Get protocol information corresponding to a protocol name. | |
| getprotobynumber | Get protocol information corresponding to a protocol number. | |
| getservbyname | Get service information corresponding to a service name and protocol. | |
| getservbyport | Get service information corresponding to a port and protocol. | |
| WSAAsyncGetHostByAddr | Get host information corresponding to an address asynchronusly. | |
| WSAAsyncGetHostByName | Get host information corresponding to a hostname asynchronusly. | |
| WSAAsyncGetProtoByName | Get protocol information corresponding to a protocol name asynchronusly. | |
| WSAAsyncGetProtoByNumber | Get protocol information corresponding to a protocol number asynchronusly. | |
| WSAAsyncGetServByName | Get service information corresponding to a service name and protocol asynchronusly. | |
| WSAAsyncGetServByPort | Get service information corresponding to a port and protocol asynchronusly. |
struct WSAData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYSSTATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char FAR * lpVendorInfo;
};
struct hostent {
char FAR * h_name;
char FAR * FAR * h_aliases;
short h_addrtype;
short h_length;
char FAR * FAR * h_addr_list;
};
struct in_addr {
union {
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { u_short s_w1,s_w2; } S_un_w;
u_long S_addr;
} S_un;
};
#define s_addr S_un.S_addr
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};