Matrix of Winsock Supported Functions

The following tables list the functions of the Winsock API that are supported by the RT-TCP/IP stack. All functions can work with either IPv4 or Ipv6 addresses unless otherwise mentioned. The address family values that are currently supported are AF_INT or AF_INT6, which are the internet address family formats for IPv4 and Ipv6.

The Winsock API is divided into 2 primary APIs: BSD and Winsock Extensions. The BSD group is Microsoft's version of the Berkeley Standard API. The Winsock extensions are additional APIs developed by Microsoft to further enhance the functionality of the protocol stack, particularly in the area of asynchronous notification of network events. The enhanced functionality provided by the Winsock extensions is not guaranteed to be deterministic. It is recommended that applications be developed using the BSD API rather than the Winsock Extensions. Winsock extensions are easy to identify by their "WSA" prefix.

NOTE: Some options for some functions are not supported. Unsupported options are listed in the Remarks section for those functions.

NOTE: For an overview of the RT-TCP/IP stack's Winsock implementation logic, see Winsock Background.

NOTE: APIs that are not explicitly documented as supported are not guaranteed to work. You should thoroughly test any code that uses undocumented functions.

Winsock BSD (deterministic)

WinSock BSD API

Description

accept

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

bind

Assigns a local name to an unnamed socket.

closesocket

Removes a socket from the per-process object reference table. Only blocks if SO_LINGER is set with a nonzero time-out on a blocking socket.

connect

Initiates a connection on the specified socket.

freeaddrinfo

Frees address info returned by a call to freeaddrinfo.

getaddrinfo

Provides protocol independent translation from hostname to address.

gethostbyname

Retrieves host information corresponding to a host name from a host database on a DNS server.

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 name of the peer connected to the specified socket.

getsockname

Retrieves the local address to which the specified socket is bound.

getsockopt

Retrieves options associated with the specified socket. RTX64 extends getsockopt with two additional options that apply at the IPPROTO_TCP level:

  • TCP_ACKDELAYTIME
    The delay period (in milliseconds) that the stack uses for delayed acknowledgements (ACKs). A value of zero indicates that delayed ACKs are disabled (that is, all data segments are acknowledged immediately). Default value is 200
  • TCP_ACKNSEG
    Acknowledgement frequency, configured to every Nth maximum-sized segment (MSS). The default for N is 2.

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 a character string representing a number in the Internet standard ".'' notation to an Internet address value.

inet_ntoa

Converts an Internet address value to an ASCII string in ".'' notation i.e., "a.b.c.d''.

inet_ntop

Converts an IPv4 or IPv6 Internet network address into a string in Internet standard format.

inet_pton

Converts an IPv4 or IPv6 Internet network address in its standard text presentation form into its numeric binary form.

ioctlsocket

Provides 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 socket.

recvfrom

Receives data from either a connected or unconnected socket.

select

Performs synchronous I/O multiplexing.

send

Sends data to a connected socket.

sendto

Sends data to either a connected or unconnected socket.

setsockopt

Stores options associated with the specified socket. RTX64 extends setsockopt with two additional options that apply at the IPPROTO_TCP level:

  • TCP_ACKDELAYTIME
    Specifies the delay period (in milliseconds) that the stack uses for delayed acknowledgements (ACKs). A value of zero disables delayed ACKs (that is, all data segments are acknowledged immediately). Default value is 200
  • TCP_ACKNSEG
    Acknowledgement frequency can be configured to every Nth maximum-sized segment (MSS) using this socket option. The default for N is 2.

shutdown

Shuts down part of a full-duplex connection.

socket

Creates an endpoint for communication and return a socket descriptor.

Winsock Extensions (non-deterministic)

WinSock Extensions

Description

WSAAccept

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

WSACleanup

Terminates use of the Winsock 2 by RTSS process.

WSAConnect

Establishes a connection to a specified socket.

WSAFDIsSet

Checks whether a socket is included in set of socket descriptors

WSAGetLastError

Returns the error status for the last Windows Sockets operation that failed.

WSAHtonl

Converts a u_long IPv4 address in host byte order to TCP/IP network byte order.

WSAHtons

Converts a u_short IPv4 address in host byte-ordering to TCP/IP network byte order.

WSAIoctl

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

WSANtohl

Converts a u_long in TCP/IP network byte order to host byte order.

WSANtohs

Converts a u_short in TCP/IP network byte order to host byte order.

WSARecv

Receives data on a socket and returns the number of bytes received.

WSARecvDisconnect

Causes a socket to be closed for receiving.

WSARecvFrom

Receives a datagram on a socket and returns the number of bytes received.

WSASend

Transmits a message on a connected socket.

WSASendDisconnect

Causes a socket to be closed for sending.

WSASendTo

Transmits a message on a connected or unconnected socket.

WSASetLastError

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

WSASocket

Creates a socket and returns an integer descriptor. The operation of WSASocket is controlled by socket-level options that are defined. setsockopt and getsockopt functions are used to set and get options.

WSAStartup

Initiate use of the Winsock by a RTSS process.