MSDN - Winsock Functions

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 6

Winsock Functions

The following list provides concise descriptions of each Winsock function. For additional
information on any function, click the function name.
Function Description
accept Permits an incoming connection attempt on a socket.
Accepts a new connection, returns the local and remote
AcceptEx address, and receives the first block of data sent by the
client application.
bind Associates a local address with a socket.
closesocket Closes an existing socket.
connect Establishes a connection to a specified socket.
Establishes a connection to a specified socket, and
ConnectEx optionally sends data once the connection is established.
Only supported on connection-oriented sockets.
Closes a connection on a socket, and allows the socket
DisconnectEx
handle to be reused.
Retrieves information about a specified set of network
EnumProtocols
protocols that are active on a local host.
Frees address information that the getaddrinfo function
freeaddrinfo
dynamically allocates in addrinfo structures.
Frees address information that the GetAddrInfoEx
FreeAddrInfoEx
function dynamically allocates in addrinfoex structures.
Frees address information that the GetAddrInfoW
FreeAddrInfoW
function dynamically allocates in addrinfoW structures.
Assists in printing error messages based on the EAI_*
gai_strerror
errors returned by the getaddrinfo function.
Parses the data obtained from a call to the AcceptEx
GetAcceptExSockaddrs
function.
Queries a namespace, or a set of default namespaces, to
retrieve network address information for a specified
network service. This process is known as service name
GetAddressByName
resolution. A network service can also use the function
to obtain local address information that it can use with
the bind function.
Provides protocol-independent translation from an ANSI
getaddrinfo
host name to an address.
Provides protocol-independent name resolution with
GetAddrInfoEx additional parameters to qualify which name space
providers should handle the request.
Provides protocol-independent translation from a
GetAddrInfoW
Unicode host name to an address.
Retrieves the host information corresponding to a
gethostbyaddr
network address.
Retrieves host information corresponding to a host name
gethostbyname from a host database. Deprecated: use getaddrinfo
instead.
gethostname Retrieves the standard host name for the local computer.
Retrieves the name of a network service for the specified
GetNameByType
service type.
Provides name resolution from an IPv4 or IPv6 address
getnameinfo to an ANSI host name and from a port number to the
ANSI service name.
Provides name resolution from an IPv4 or IPv6 address
GetNameInfoW to a Unicode host name and from a port number to the
Unicode service name.
Retrieves the address of the peer to which a socket is
getpeername
connected.
Retrieves the protocol information corresponding to a
getprotobyname
protocol name.
Retrieves protocol information corresponding to a
getprotobynumber
protocol number.
Retrieves service information corresponding to a service
getservbyname
name and protocol.
Retrieves service information corresponding to a port
getservbyport
and protocol.
Retrieves information about a network service in the
GetService context of a set of default namespaces or a specified
namespace.
getsockname Retrieves the local name for a socket.
getsockopt Retrieves a socket option.
Retrieves a service type GUID for a network service
GetTypeByName
specified by name.
Converts a u_long from host to TCP/IP network byte
htonl
order (which is big-endian).
Converts a u_short from host to TCP/IP network byte
htons
order (which is big-endian).
Converts a string containing an (Ipv4) Internet Protocol
inet_addr dotted address into a proper address for the in_addr
structure.
Converts an (IPv4) Internet network address into a string
inet_ntoa
in Internet standard dotted format.
converts an IPv4 or IPv6 Internet network address into a
InetNtop string in Internet standard format. The ANSI version of
this function is inet_ntop.
Converts an IPv4 or IPv6 Internet network address in its
InetPton standard text presentation form into its numeric binary
form. The ANSI version of this function is inet_pton.
ioctlsocket Controls the I/O mode of a socket.
Places a socket a state where it is listening for an
listen
incoming connection.
Converts a u_long from TCP/IP network order to host
ntohl
byte order (which is little-endian on Intel processors).
Converts a u_short from TCP/IP network byte order to
ntohs host byte order (which is little-endian on Intel
processors).
recv Receives data from a connected or bound socket.
recvfrom Receives a datagram and stores the source address.
Determines the status of one or more sockets, waiting if
select
necessary, to perform synchronous I/O.
send Sends data on a connected socket.
sendto Sends data to a specific destination.
Registers a host and service name along with associated
SetAddrInfoEx
addresses with a specific namespace provider.
Registers or removes from the registry a network service
SetService within one or more namespaces. Can also add or remove
a network service type within one or more namespaces.
setsockopt Sets a socket option.
shutdown Disables sends or receives on a socket.
Creates a socket that is bound to a specific service
socket
provider.
TransmitFile Transmits file data over a connected socket handle.
Transmits in-memory data or file data over a connected
TransmitPackets
socket.
Conditionally accepts a connection based on the return
value of a condition function, provides quality of service
WSAAccept
flow specifications, and allows the transfer of
connection data.
Converts all components of a sockaddr structure into a
WSAAddressToString
human-readable string representation of the address.
Asynchronously retrieves host information that
WSAAsyncGetHostByAddr
corresponds to an address.
Asynchronously retrieves host information that
WSAAsyncGetHostByName
corresponds to a host name.
Asynchronously retrieves protocol information that
WSAAsyncGetProtoByName
corresponds to a protocol name.
Asynchronously retrieves protocol information that
WSAAsyncGetProtoByNumber
corresponds to a protocol number.
Asynchronously retrieves service information that
WSAAsyncGetServByName
corresponds to a service name and port.
Asynchronously retrieves service information that
WSAAsyncGetServByPort
corresponds to a port and protocol.
Requests Windows message-based notification of
WSAAsyncSelect
network events for a socket.
WSACancelAsyncRequest Cancels an incomplete asynchronous operation.
WSACleanup Terminates use of the Ws2_32.DLL.
WSACloseEvent Closes an open event object handle.
Establishes a connection to another socket application,
WSAConnect exchanges connect data, and specifies needed quality of
service based on the specified FLOWSPEC structure.
Establishes a connection to one out of a collection of
WSAConnectByList possible endpoints represented by a set of destination
addresses (host names and ports).
Establishes a connection to another socket application
WSAConnectByName
on a specified host and port
WSACreateEvent Creates a new event object.
Removes the association between a peer target name and
WSADeleteSocketPeerTargetName
an IP address for a socket.
Returns a structure that can be used to create a new
WSADuplicateSocket
socket descriptor for a shared socket.
WSAEnumNameSpaceProviders Retrieves information about available namespaces.
WSAEnumNameSpaceProvidersEx Retrieves information about available namespaces.
Discovers occurrences of network events for the
WSAEnumNetworkEvents indicated socket, clear internal network event records,
and reset event objects (optional).
Retrieves information about available transport
WSAEnumProtocols
protocols.
Specifies an event object to be associated with the
WSAEventSelect
specified set of FD_XXX network events.
Specifies whether a socket is included in a set of socket
__WSAFDIsSet
descriptors.
WSAGetLastError Returns the error status for the last operation that failed.
Retrieves the results of an overlapped operation on the
WSAGetOverlappedResult
specified socket.
Initializes a QOS structure based on a named template,
WSAGetQOSByName or it supplies a buffer to retrieve an enumeration of the
available template names.
Retrieves the class information (schema) pertaining to a
WSAGetServiceClassInfo specified service class from a specified namespace
provider.
Retrieves the name of the service associated with the
WSAGetServiceClassNameByClassId
specified type.
Converts a u_long from host byte order to network byte
WSAHtonl
order.
Converts a u_short from host byte order to network byte
WSAHtons
order.
Used to impersonate the security principal
WSAImpersonateSocketPeer corresponding to a socket peer in order to perform
application-level authorization.
WSAInstallServiceClass Registers a service class schema within a namespace.
WSAIoctl Controls the mode of a socket.
Joins a leaf node into a multipoint session, exchanges
WSAJoinLeaf connect data, and specifies needed quality of service
based on the specified structures.
Initiates a client query that is constrained by the
WSALookupServiceBegin information contained within a WSAQUERYSET
structure.
Frees the handle used by previous calls to
WSALookupServiceEnd WSALookupServiceBegin and
WSALookupServiceNext.
WSALookupServiceNext Retrieve the requested service information.
Developers to make I/O control calls to a registered
WSANSPIoctl
namespace.
Converts a u_long from network byte order to host byte
WSANtohl
order.
Converts a u_short from network byte order to host byte
WSANtohs
order.
WSAPoll Determines status of one or more sockets.
Notifies the application when the provider configuration
WSAProviderConfigChange
is changed.
Queries information about the security applied to a
WSAQuerySocketSecurity
connection on a socket.
WSARecv Receives data from a connected socket.
Terminates reception on a socket, and retrieves the
WSARecvDisconnect
disconnect data if the socket is connection oriented.
WSARecvEx Receives data from a connected socket.
WSARecvFrom Receives a datagram and stores the source address.
Receives data and optional control information from
WSARecvMsg
connected and unconnected sockets.
Permanently removes the service class schema from the
WSARemoveServiceClass
registry.
Resets the state of the specified event object to
WSAResetEvent
nonsignaled.
WSARevertImpersonation Terminates the impersonation of a socket peer.
WSASend Sends data on a connected socket.
Initiates termination of the connection for the socket and
WSASendDisconnect
sends disconnect data.
Sends data and optional control information from
WSASendMsg
connected and unconnected sockets.
WSASendTo Sends data to a specific destination, using overlapped
I/O where applicable.
WSASetEvent Sets the state of the specified event object to signaled.
WSASetLastError Sets the error code.
Registers or removes from the registry a service instance
WSASetService
within one or more namespaces.
Used to specify the peer target name (SPN) that
corresponds to a peer IP address. This target name is
WSASetSocketPeerTargetName
meant to be specified by client applications to securely
identify the peer that should be authenticated.
WSASetSocketSecurity Enables and applies security for a socket.
Creates a socket that is bound to a specific transport-
WSASocket
service provider.
WSAStartup Initiates use of WS2_32.DLL by a process.
WSAStringToAddress Converts a numeric string to a sockaddr structure.
Returns either when one or all of the specified event
WSAWaitForMultipleEvents objects are in the signaled state, or when the time-out
interval expires.

You might also like