WinSocks

INT WSAGetLastError()


Returns the error status for the last operation that failed.


SOCKET accept(
    SOCKET sSocket,
    const sockaddr_in * psaAddr,
    INT * iAddrlen)


Permits an incoming connection attempt on a socket.


INT bind(
    SOCKET sSocket,
    const sockaddr_in * psaName,
    INT iNamelen)


Associates a local address with a socket.


INT closesocket(
    SOCKET sSocket)


Closes an existing socket.


INT connect(
    SOCKET sSocket,
    const sockaddr_in * saName,
    INT iNameLen)


Retrieves the host information corresponding to a network address.


hostent * gethostbyaddr(
    const CHAR * pcAddr,
    INT iLen,
    INT iType)


Retrieves the host information corresponding to a network address.


hostent * gethostbyname(
    const CHAR * pcName)


Retrieves host information corresponding to a host name from a host database.


INT gethostname(
    CHAR * pcName,
    INT iNameLen)


Retrieves the standard host name for the local computer.


INT getpeername(
    SOCKET sSocket,
    sockaddr_in * psaName,
    INT * piNameLen)


Retrieves the name of the peer to which a socket is connected.


protoent * getprotobyname(
    const CHAR * pcName)


Retrieves the protocol information corresponding to a protocol name.


protoent * getprotobynumber(
    INT iNumber)


Retrieves protocol information corresponding to a protocol number.


servent * getservbyname(
    const CHAR * pcName,
    const CHAR * pcProto)


Retrieves service information corresponding to a service name and protocol.


servent * getservbyport(
    INT iPort,
    const CHAR * pcProto)


Retrieves service information corresponding to a port and protocol.


INT getsockname(
    SOCKET sSocket,
    sockaddr_in * psaName,
    INT * piNameLen)


Retrieves the local name for a socket.


INT getsockopt(
    SOCKET sSocket,
    INT iLevel,
    INT iOptName,
    const CHAR * pcOptVal,
    INT * piOptLen)


Retrieves a socket option.


ULONG htonl(
    ULONG ulHostLong)


Converts a ULONG from host to TCP/IP network byte order (which is big endian).


USHORT htons(
    USHORT usHostShort)


Converts a USHORT from host to TCP/IP network byte order (which is big-endian).


ULONG inet_addr(
    const CHAR * pcAddr)


Converts a string containing an (Ipv4) Internet Protocol dotted address into a proper address for the IN_ADDR structure.


CHAR * inet_ntoa(
    ULONG iaAddr)


Converts an (Ipv4) Internet network address into a string in Internet standard dotted format. If no error occurs, inet_ntoa returns a character pointer to a static buffer containing the text address in standard "."notation. Otherwise, it returns NULL.


INT ioctlsocket(
    SOCKET sSocket,
    LONG lCmd,
    ULONG * pulArgp)


Controls the I/O mode of a socket.


INT listen(
    SOCKET sSocket,
    INT iBacklog)


Places a socket in a state in which it is listening for an incoming connection.


INT recv(
    SOCKET sSocket,
    CHAR * pcBuf,
    INT iLen,
    INT iFlags)


Retrieves data from a connected or bound socket.


INT recvfrom(
    SOCKET sSocket,
    CHAR * pcBuf,
    INT iLen,
    INT iFlags,
    sockaddr_in * pasFrom,
    INT * piFromLen)


Retrieves a datagram and stores the source address.


INT select(
    INT iNfds,
    fd_set * pfsReadFds,
    fd_set * pfsWriteFds,
    fd_set * pfsExceptFds,
    timeval * ptTimeout)


Determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.


INT send(
    SOCKET sSocket,
    const CHAR * pcBuf,
    INT iLen,
    INT iFlags)


Sends data on a connected socket.


INT sendto(
    SOCKET sSocket,
    CHAR * pcBuf,
    INT iLen,
    INT iFlags,
    sockaddr_in * psaTo,
    INT iToLen)


Sends data to a specific destination.


INT setsockopt(
    SOCKET sSocket,
    INT iLevel,
    INT iOptName,
    const CHAR * pcOptVal,
    INT iOptLen)


Sets a socket option.
If iLevel = SOL_SOCKET, iOptName should be on of the SO_* enumerated values (note that not all values are accepted).
If iLevel = IPPROTO_TCP1, iOptName should be one of the TCP_* enumerated values.


INT shutdown(
    SOCKET sSocket,
    INT iHow)


Disables sends or receives on a socket.


SOCKET socket(
    INT iAf,
    INT iType,
    INT iProtocol)


Creates a socket that is bound to a specific service provider.
iType can be one of the following values:
    SOCK_STREAM: Provides sequenced, reliable, two-way, connection-based byte streams with an OOB data transmission mechanism. Uses TCP for the Internet address family.
    SOCK_DGRAM: Supports datagrams, which are connectionless, unreliable buffers of a fixed (typically small) maximum length. Uses UDP for the Internet address family.
    SOCK_RAW: Provides access to internal network protocols and interfaces. Available only to individuals with root user authority, a raw socket allows an application direct access to lower-level communication protocols. Raw sockets are intended for advanced users who wish to take advantage of some protocol feature that is not directly accessible through a normal interface, or who wish to build new protocols atop existing low-level protocols.
    SOCK_RDM: Similar to SOCK_DGRAM, except that the reliability of the message is guaranteed.
    SOCK_SEQPACKET: Provides sequenced, reliable, and unduplicated flow of information.


Copyright © 2006 Shawn (L. Spiro) Wilcoxen