winsock2.h header
This header is used by multiple technologies. For more information, see:
winsock2.h contains the following programming interfaces:
__WSAFDIsSet The __WSAFDIsSet function (winsock2.h) specifies whether a socket is included in a set of socket descriptors. |
accept The accept function permits an incoming connection attempt on a socket. |
bind The bind function associates a local address with a socket. (bind function (winsock2.h)) |
closesocket The closesocket function closes an existing socket. (closesocket function (winsock2.h)) |
connect The connect function establishes a connection to a specified socket. |
FD_SET The FD_SET macro (winsock2.h) is used by Windows Sockets (Winsock) functions and service providers to place sockets into a set. |
gethostbyaddr The gethostbyaddr function retrieves the host information corresponding to a network address. (gethostbyaddr is no longer recommended, use getnameinfo instead) |
gethostbyname The gethostbyname function (winsock2.h) function retrieves host information corresponding to a host name from a host database. |
gethostname The gethostname function (winsock2.h) retrieves the standard host name for the local computer. |
GetHostNameW The GetHostNameW function retrieves the standard host name for the local computer as a Unicode string. |
getpeername The getpeername function (winsock2.h) retrieves the address of the peer to which a socket is connected. |
getprotobyname The getprotobyname function (winsock2.h) retrieves the protocol information corresponding to a protocol name. |
getprotobynumber The getprotobynumber function (winsock2.h) retrieves protocol information corresponding to a protocol number. |
getservbyname The getservbyname function (winsock2.h) retrieves service information corresponding to a service name and protocol. |
getservbyport The getservbyport function (winsock2.h) retrieves service information corresponding to a port and protocol. |
getsockname The getsockname function (winsock2.h) retrieves the local name for the specified socket descriptor. |
getsockopt The getsockopt function retrieves the current value for a socket option associated with a socket of any type, in any state, and stores the result in optval. |
htond Converts a double from host to TCP/IP network byte order (which is big-endian). |
htonf Converts a float from host to TCP/IP network byte order (which is big-endian). |
htonl The htonl function (winsock2.h) converts a u_long from host to TCP/IP network byte order, which is big-endian. |
htonll Converts an unsigned __int64 from host to TCP/IP network byte order (which is big-endian). |
htons The htons function (winsock2.h) converts a u_short from host to TCP/IP network byte order, which is big-endian. |
inet_addr The inet_addr function (winsock2.h) converts a string containing an IPv4 dotted-decimal address into a proper address for the IN_ADDR structure. |
inet_ntoa The inet_ntoa function (winsock2.h) converts an (Ipv4) Internet network address into an ASCII string in Internet standard dotted-decimal format. |
ioctlsocket The ioctlsocket function (winsock2.h) controls the I/O mode of a socket and can be used on any socket in any state. |
listen The listen function places a socket in a state in which it is listening for an incoming connection. |
ntohd Converts an unsigned __int64 from TCP/IP network order to host byte order (which is little-endian on Intel processors) and returns a double. |
ntohf Converts an unsigned __int32 from TCP/IP network order to host byte order (which is little-endian on Intel processors) and returns a float. |
ntohl The ntohl function (winsock2.h) converts a u_long from TCP/IP network order to host byte order (which is little-endian on Intel processors). |
ntohll Converts an unsigned __int64 from TCP/IP network order to host byte order (which is little-endian on Intel processors). |
ntohs The ntohs function (winsock2.h) converts a u_short from TCP/IP network byte order to host byte order (which is little-endian on Intel processors). |
ProcessSocketNotifications Associates a set of sockets with a completion port, and retrieves any notifications that are already pending on that port. Once associated, the completion port receives the socket state notifications that were specified. |
recv The recv function (winsock2.h) receives data from a connected socket or a bound connectionless socket. |
recvfrom The recvfrom function receives a datagram, and stores the source address. |
select The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O. |
send Sends data on a connected socket. (send) |
sendto The sendto function (winsock2.h) is used to write outgoing data on a socket. |
setsockopt The setsockopt function (winsock2.h) sets the current value for a socket option associated with a socket of any type, in any state. |
shutdown The shutdown function (winsock2.h) is used on all types of sockets to disable reception, transmission, or both. |
socket The socket function creates a socket that is bound to a specific transport service provider. |
SocketNotificationRetrieveEvents This inline helper function is provided as a convenience to retrieve the events mask from an OVERLAPPED_ENTRY. |
WSAAccept The WSAAccept function conditionally accepts a connection based on the return value of a condition function, provides quality of service flow specifications, and allows the transfer of connection data. |
WSAAddressToStringA Converts all components of a sockaddr structure into a human-readable string representation of the address. (ANSI) |
WSAAddressToStringW Converts all components of a sockaddr structure into a human-readable string representation of the address. (Unicode) |
WSAAsyncGetHostByAddr The WSAAsyncGetHostByAddr function (winsock2.h) asynchronously retrieves host information that corresponds to an address. |
WSAAsyncGetHostByName The WSAAsyncGetHostByName function (winsock2.h) asynchronously retrieves host information that corresponds to a host name. |
WSAAsyncGetProtoByName The WSAAsyncGetProtoByName function (winsock2.h) asynchronously retrieves protocol information that corresponds to a protocol name. |
WSAAsyncGetProtoByNumber The WSAAsyncGetProtoByNumber function (winsock2.h) asynchronously retrieves protocol information that corresponds to a protocol number. |
WSAAsyncGetServByName The WSAAsyncGetServByName function (winsock2.h) asynchronously retrieves service information that corresponds to a service name and port. |
WSAAsyncGetServByPort The WSAAsyncGetServByPort function (winsock2.h) asynchronously retrieves service information that corresponds to a port and protocol. |
WSAAsyncSelect The WSAAsyncSelect function (winsock2.h) requests Windows message based notification of network events for a socket. |
WSACancelAsyncRequest The WSACancelAsyncRequest function (winsock2.h) cancels an incomplete asynchronous operation. |
WSACancelBlockingCall The WSACancelBlockingCall function has been removed in compliance with the Windows Sockets 2 specification, revision 2.2.0. |
WSACleanup The WSACleanup function (winsock2.h) terminates use of the WS2_32.dll. |
WSACloseEvent The WSACloseEvent function closes an open event object handle. |
WSAConnect The WSAConnect function establishes a connection to another socket application, exchanges connect data, and specifies required quality of service based on the specified FLOWSPEC structure. |
WSAConnectByList Establishes a connection to one out of a collection of possible endpoints represented by a set of destination addresses (host names and ports). |
WSAConnectByNameA Establishes a connection to a specified host and port. (ANSI) |
WSAConnectByNameW Establishes a connection to a specified host and port. (Unicode) |
WSACreateEvent The WSACreateEvent function creates a new event object. |
WSADuplicateSocketA The WSADuplicateSocket function returns a WSAPROTOCOL_INFO structure that can be used to create a new socket descriptor for a shared socket. The WSADuplicateSocket function cannot be used on a QOS-enabled socket. (ANSI) |
WSADuplicateSocketW The WSADuplicateSocket function returns a WSAPROTOCOL_INFO structure that can be used to create a new socket descriptor for a shared socket. The WSADuplicateSocket function cannot be used on a QOS-enabled socket. (Unicode) |
WSAEnumNameSpaceProvidersA The WSAEnumNameSpaceProviders function retrieves information on available namespace providers. (ANSI) |
WSAEnumNameSpaceProvidersExA Retrieves information on available namespace providers. (ANSI) |
WSAEnumNameSpaceProvidersExW Retrieves information on available namespace providers. (Unicode) |
WSAEnumNameSpaceProvidersW The WSAEnumNameSpaceProviders function retrieves information on available namespace providers. (Unicode) |
WSAEnumNetworkEvents The WSAEnumNetworkEvents function discovers occurrences of network events for the indicated socket, clear internal network event records, and reset event objects (optional). |
WSAEnumProtocolsA The WSAEnumProtocols function retrieves information about available transport protocols. (ANSI) |
WSAEnumProtocolsW The WSAEnumProtocols function retrieves information about available transport protocols. (Unicode) |
WSAEventSelect The WSAEventSelect function specifies an event object to be associated with the specified set of FD_XXX network events. |
WSAGetLastError The WSAGetLastError function (winsock2.h) returns the error status for the last Windows Sockets operation that failed. |
WSAGetOverlappedResult The WSAGetOverlappedResult function retrieves the results of an overlapped operation on the specified socket. |
WSAGetQOSByName The WSAGetQOSByName function initializes a QOS structure based on a named template, or it supplies a buffer to retrieve an enumeration of the available template names. |
WSAGetServiceClassInfoA The WSAGetServiceClassInfo function retrieves the class information (schema) pertaining to a specified service class from a specified namespace provider. (ANSI) |
WSAGetServiceClassInfoW The WSAGetServiceClassInfo function retrieves the class information (schema) pertaining to a specified service class from a specified namespace provider. (Unicode) |
WSAGetServiceClassNameByClassIdA The WSAGetServiceClassNameByClassId function retrieves the name of the service associated with the specified type. This name is the generic service name, like FTP or SNA, and not the name of a specific instance of that service. (ANSI) |
WSAGetServiceClassNameByClassIdW The WSAGetServiceClassNameByClassId function retrieves the name of the service associated with the specified type. This name is the generic service name, like FTP or SNA, and not the name of a specific instance of that service. (Unicode) |
WSAHtonl The WSAHtonl function converts a u_long from host byte order to network byte order. |
WSAHtons The WSAHtons function converts a u_short from host byte order to network byte order. |
WSAInstallServiceClassA The WSAInstallServiceClass function registers a service class schema within a namespace. (ANSI) |
WSAInstallServiceClassW The WSAInstallServiceClass function registers a service class schema within a namespace. (Unicode) |
WSAIoctl The WSAIoctl function controls the mode of a socket. |
WSAIsBlocking This function has been removed in compliance with the Windows Sockets 2 specification, revision 2.2.0. (WSAIsBlocking) |
WSAJoinLeaf The WSAJoinLeaf function joins a leaf node into a multipoint session, exchanges connect data, and specifies needed quality of service based on the specified FLOWSPEC structures. |
WSALookupServiceBeginA The WSALookupServiceBegin function initiates a client query that is constrained by the information contained within a WSAQUERYSET structure. (ANSI) |
WSALookupServiceBeginW The WSALookupServiceBegin function initiates a client query that is constrained by the information contained within a WSAQUERYSET structure. (Unicode) |
WSALookupServiceEnd The WSALookupServiceEnd function is called to free the handle after previous calls to WSALookupServiceBegin and WSALookupServiceNext. |
WSALookupServiceNextA The WSALookupServiceNext function is called after obtaining a handle from a previous call to WSALookupServiceBegin in order to retrieve the requested service information. (ANSI) |
WSALookupServiceNextW The WSALookupServiceNext function is called after obtaining a handle from a previous call to WSALookupServiceBegin in order to retrieve the requested service information. (Unicode) |
WSANSPIoctl Enables developers to make I/O control calls to a registered namespace. |
WSANtohl The WSANtohl function converts a u_long from network byte order to host byte order. |
WSANtohs The WSANtohs function converts a u_short from network byte order to host byte order. |
WSAPoll The WSAPoll function determines status of one or more sockets. |
WSAProviderConfigChange The WSAProviderConfigChange function notifies the application when the provider configuration is changed. |
WSARecv Receives data from a connected socket or a bound connectionless socket. (WSARecv) |
WSARecvDisconnect The WSARecvDisconnect function terminates reception on a socket, and retrieves the disconnect data if the socket is connection oriented. |
WSARecvFrom Receives a datagram and stores the source address. |
WSARemoveServiceClass The WSARemoveServiceClass function permanently removes the service class schema from the registry. |
WSAResetEvent The WSAResetEvent function resets the state of the specified event object to nonsignaled. |
WSASend Sends data on a connected socket. (WSASend) |
WSASendDisconnect The WSASendDisconnect function initiates termination of the connection for the socket and sends disconnect data. |
WSASendMsg Sends data and optional control information from connected and unconnected sockets. Note This function is a Microsoft-specific extension to the Windows Sockets specification. . |
WSASendTo Sends data to a specific destination, using overlapped I/O where applicable. |
WSASetBlockingHook This function has been removed in compliance with the Windows Sockets 2 specification, revision 2.2.0. (WSASetBlockingHook) |
WSASetEvent The WSASetEvent function sets the state of the specified event object to signaled. |
WSASetLastError The WSASetLastError function (winsock2.h) sets the error code that can be retrieved through the WSAGetLastError function. |
WSASetServiceA The WSASetService function registers or removes from the registry a service instance within one or more namespaces. (ANSI) |
WSASetServiceW The WSASetService function registers or removes from the registry a service instance within one or more namespaces. (Unicode) |
WSASocketA The WSASocket function creates a socket that is bound to a specific transport-service provider. (ANSI) |
WSASocketW The WSASocket function creates a socket that is bound to a specific transport-service provider. (Unicode) |
WSAStartup The WSAStartup function (winsock2.h) initiates use of the Winsock DLL by a process. |
WSAStringToAddressA The WSAStringToAddress function converts a network address in its standard text presentation form into its numeric binary form in a sockaddr structure, suitable for passing to Windows Sockets routines that take such a structure. (ANSI) |
WSAStringToAddressW The WSAStringToAddress function converts a network address in its standard text presentation form into its numeric binary form in a sockaddr structure, suitable for passing to Windows Sockets routines that take such a structure. (Unicode) |
WSAUnhookBlockingHook This function has been removed in compliance with the Windows Sockets 2 specification, revision 2.2.0. (WSAUnhookBlockingHook) |
WSAWaitForMultipleEvents Returns when one or all of the specified event objects are in the signaled state, when the time-out interval expires, or when an I/O completion routine has executed. |
LPWSAOVERLAPPED_COMPLETION_ROUTINE TBD (LPWSAOVERLAPPED_COMPLETION_ROUTINE) |
AFPROTOCOLS The AFPROTOCOLS structure supplies a list of protocols to which application programmers can constrain queries. The AFPROTOCOLS structure is used for query purposes only. |
BLOB The BLOB structure (winsock2.h), derived from Binary Large Object, contains information about a block of data. |
fd_set The Fd_set structure (winsock2.h) is used by Windows Sockets (Winsock) functions and service providers to place sockets into a set. |
HOSTENT The HOSTENT structure (winsock2.h) is used by functions to store information about a given host, such as host name, IPv4 address, and so forth. |
in_addr The in_addr structure represents an IPv4 Internet address. |
LINGER The LINGER structure (winsock2.h) maintains information about a specific socket that specifies how that socket should behave when data is queued. |
PROTOENT The PROTOENT structure (winsock2.h) contains the name and protocol numbers that correspond to a given protocol name. |
QOS The QOS structure provides the means by which QOS-enabled applications can specify quality of service parameters for sent and received traffic on a particular flow. |
SERVENT The SERVENT structure (winsock2.h) is used to store or return the name and service number for a given service name. |
SOCK_NOTIFY_REGISTRATION Represents info supplied to the ProcessSocketNotifications function. |
TIMEVAL The TIMEVAL structure (winsock2.h) is used to specify a time interval. It is associated with the Berkeley Software Distribution (BSD) Time.h header file. |
WSACOMPLETION Specifies completion notification settings for I/O control calls made to a registered namespace. |
WSADATA The WSADATA structure (winsock2.h) contains information about the Windows Sockets implementation. |
WSANAMESPACE_INFOA Contains all registration information for a namespace provider. (WSANAMESPACE_INFOA) |
WSANAMESPACE_INFOEXA Contains all registration information for a namespace provider. (WSANAMESPACE_INFOEXA) |
WSANAMESPACE_INFOEXW Contains all registration information for a namespace provider. (WSANAMESPACE_INFOEXW) |
WSANAMESPACE_INFOW Contains all registration information for a namespace provider. (WSANAMESPACE_INFOW) |
WSANETWORKEVENTS The WSANETWORKEVENTS structure is used to store a socket's internal information about network events. |
WSANSCLASSINFOA The WSANSCLASSINFO structure provides individual parameter information for a specific Windows Sockets namespace. (ANSI) |
WSANSCLASSINFOW The WSANSCLASSINFO structure provides individual parameter information for a specific Windows Sockets namespace. (Unicode) |
WSAOVERLAPPED Provides a communication medium between the initiation of an overlapped I/O operation and its subsequent completion. |
WSAPOLLFD Stores socket information used by the WSAPoll function. |
WSAPROTOCOL_INFOA Used to store or retrieve complete information for a given protocol. (ANSI) |
WSAPROTOCOL_INFOW Used to store or retrieve complete information for a given protocol. (Unicode) |
WSAPROTOCOLCHAIN The WSAPROTOCOLCHAIN structure contains a counted list of Catalog Entry identifiers that comprise a protocol chain. |
WSAQUERYSET2A Provides relevant information about a given service, including service class ID, service name , applicable namespace identifier and protocol information, as well as a set of transport addresses at which the service listens. (ANSI) |
WSAQUERYSET2W Provides relevant information about a given service, including service class ID, service name , applicable namespace identifier and protocol information, as well as a set of transport addresses at which the service listens. (Unicode) |
WSAQUERYSETA Provides relevant information about a given service, including service class ID, service name, applicable namespace identifier and protocol information, as well as a set of transport addresses at which the service listens. (ANSI) |
WSAQUERYSETW Provides relevant information about a given service, including service class ID, service name, applicable namespace identifier and protocol information, as well as a set of transport addresses at which the service listens. (Unicode) |
WSASERVICECLASSINFOA The WSASERVICECLASSINFO structure contains information about a specified service class. For each service class in Windows Sockets 2, there is a single WSASERVICECLASSINFO structure. (ANSI) |
WSASERVICECLASSINFOW The WSASERVICECLASSINFO structure contains information about a specified service class. For each service class in Windows Sockets 2, there is a single WSASERVICECLASSINFO structure. (Unicode) |
WSAVERSION The WSAVERSION structure provides version comparison in Windows Sockets. |
WSAECOMPARATOR The Windows Sockets WSAECOMPARATOR enumeration type is used for version-comparison semantics in Windows Sockets 2. |