Winsock API Reference

The supported Winsock API functions are listed below.

WinSock BSD API

Description

accept

Returns a new socket that corresponds to an established connection from the listening socket queue.

bind

Assigns a local IP address and port to an unnamed socket.

closesocket

Closes (removes) a socket created by function socket or returned by function accept. If a socket is connected, closesocket closes the connection first.

connect

Initiates a connection on the specified socket. For a connectionless protocol, it restricts communications to one peer, instead of establishing a connection.

freeaddrinfo

Frees address information dynamically allocated by function getaddrinfo.

getaddrinfo

Provides protocol independent translation from hostname to an IP address.

gethostbyname

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

gethostname

Returns an ASCII string that can be used with gethostbyname.

getnameinfo

Provides name resolution from an address to the host name.

getpeername

Retrieves the IP address and port of the peer connected to the specified socket.

getsockname

Retrieves the local IP address and port to which the specified socket is bound.

getsockopt

Retrieves an option associated with the specified socket.

htonl

Converts a 32-bit quantity from host-byte order to network-byte order.

htons

Converts a 16-bit quantity from host-byte order to network-byte order.

inet_addr

Converts an ASCII string containing a standard dotted-decimal address to binary IPv4 address in network byte order.

inet_ntoa

Converts a binary IPv4 address in network byte order to an ASCII string in standard dotted-decimal format.

inet_ntop

Converts an IPv4 or IPv6 Internet network address in network byte order to an ASCII string in Internet standard text presentation.

inet_pton

Converts an ASCII string of IPv4 or IPv6 Internet network address in its standard text presentation form into its numeric binary form in network byte order.

ioctlsocket

Provides I/O control for sockets.

listen

Listens for incoming connections on a specified socket.

ntohl

Converts a 32-bit quantity from network-byte order to host-byte order.

ntohs

Converts a 16-bit quantity from network byte order to host byte order.

recv

Receives data from a connected or socket.

recvfrom

Receives data from either a connected or unconnected socket, but not a TCP socket.

select

Performs synchronous I/O multiplexing.

send

Sends data on a connected socket.

sendto

Sends data on an unconnected socket, but never on a TCP socket.

setsockopt

Stores options associated with the specified socket.

shutdown

Shuts down part or all of a full-duplex connection.

socket

Creates an endpoint for communication and returns a socket descriptor.

WSACleanup

Terminates use of the RT-TCP/IP stack within an RTSS process.

WSAFDIsSet

Checks whether a socket is included in set of socket descriptors.

WSAGetlastError

Gets the status for the last Winsock operation that failed.

WSAHtonl

Converts a 32-bit quantity in host byte order to network byte order.

WSAHtons

Converts a 16-bit quantity in host byte-ordering to network byte order.

WSAIoctl

Performs a protocol-specific I/O control action on the socket in any state.

WSANtohl

WSANtohl Converts a 32-bit quantity in network byte order to host byte order.

WSANtohs

WSANtohs Converts a 16-bit quantity in network byte order to host byte order.

WSASetLastError

Sets the error code which can be retrieved by WSAGetLastError call for the current thread.

WSAStartup

Initiates the use of RT-TCP/IP by an RTSS process.

 

See Also