Winsock Functions
This section provides a comprehensive reference for the Windows Sockets API (Winsock) functions. These functions enable applications to communicate over a network using the TCP/IP protocol suite and other network protocols.
Core Functions
accept- Accepts a connection on a socket.bind- Associates a local address with a socket.closesocket- Closes an existing socket.connect- Establishes a connection to a remote socket.getaddrinfo- Retrieves address information for a specified host and service.gethostname- Retrieves the standard host name for the current computer.getpeername- Retrieves the name of the remote station connected to a socket.getsockname- Retrieves the current name as assigned to a 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 IPv4 address string to its binary form.inet_ntoa- Converts an IPv4 address in binary form to its ASCII string representation.ioctlsocket- Sets or retrieves the nonblocking mode of a socket.listen- Puts a socket into a state where it listens for incoming connection requests.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.send- Sends data on a connected socket.socket- Creates a socket that is bound to a specific transport service provider.
Session Management Functions
WSAAccept- Accepts a connection on a specified socket.WSAConnect- Establishes a connection to a remote socket.WSADuplicateSocket- Duplicates an existing socket handle.WSAGetQOS- Retrieves Quality of Service (QOS) information.WSAGetServiceClassNameByClassId- Retrieves the service class name.WSAGetServiceLinker- Retrieves a service linker.WSAJoinLeaf- Joins aמיני-group or establishes a multipoint connection.WSALookupServiceBegin- Initializes a service lookup operation.WSALookupServiceEnd- Cleans up a service lookup operation.WSALookupServiceNext- Retrieves the next service entry.WSANamespaceBrowseBegin- Initializes a namespace browse operation.WSANamespaceBrowseEnd- Cleans up a namespace browse operation.WSANamespaceNext- Retrieves the next namespace entry.WSAPoll- Monitors a set of sockets.WSAProtocolInfo- Retrieves protocol chain information.WSARemoveServiceClass- Removes a service class entry.WSAResetServiceClass- Resets a service class entry.WSASend- Sends data on a connected socket.WSASendDisconnect- Initiates a disconnection.WSASendFile- Transmits file data over a connected socket.WSASetService- Records or removes a service entry.WSASetSocketName- Sets the name for a socket.WSASocket- Creates a socket.
Helper Functions and Information Retrieval
gethostbyaddr- Retrieves host information by IP address.gethostbyname- Retrieves host information by name.getservbyname- Retrieves service information by name.getservbyport- Retrieves service information by port number.gai_strerror- Returns a string describing an address information error.inet_ntop- Converts an IP address structure to a string.inet_pton- Converts an IP address string to a structure.setsockopt- Sets socket options.getsockopt- Retrieves socket options.select- Monitors sockets for readiness.WSAAsyncSelect- Enables asynchronous network event notification.WSAAsyncGetAddrInfo- Asynchronously retrieves address information.WSAEnumNetworkEvents- Enumerates network events.WSAEventSelect- Associates a WSAEvent object with a socket for network event notification.WSASetEvent- Sets a WSAEvent object.WSACreateEvent- Creates a WSAEvent object.WSACloseEvent- Closes a WSAEvent object.
For detailed information on each function, including parameters, return values, and usage examples, please refer to the specific function documentation.