winsock topic

Windows Socket Library

Windows Sockets 2 (Winsock) enables programmers to create advanced Internet, intranet, and other network-capable applications to transmit application data across the wire, independent of the network protocol being used. With Winsock, programmers are provided access to Windows networking capabilities such as multicast and Quality of Service (QoS).

Functions

accept(SOCKET s, Pointer<SOCKADDR>? addr, Pointer<Int32>? addrlen) Win32Result<SOCKET> winsock
Permits an incoming connection attempt on a socket.
bind(SOCKET s, Pointer<SOCKADDR> name, int namelen) Win32Result<int> winsock
Associates a local address with a socket.
closesocket(SOCKET s) Win32Result<int> winsock
Closes an existing socket.
connect(SOCKET s, Pointer<SOCKADDR> name, int namelen) Win32Result<int> winsock
Establishes a connection to a specified socket.
GetAddrInfo(PCWSTR? pNodeName, PCWSTR? pServiceName, Pointer<ADDRINFO>? pHints, Pointer<Pointer<ADDRINFO>> ppResult) int winsock
Provides protocol-independent translation from a Unicode host name to an address.
gethostname(PSTR name, int namelen) Win32Result<int> winsock
Retrieves the standard host name for the local computer.
getnameinfo(Pointer<SOCKADDR> pSockaddr, socklen_t sockaddrLength, PSTR? pNodeBuffer, int nodeBufferSize, PSTR? pServiceBuffer, int serviceBufferSize, int flags) Win32Result<int> winsock
Provides protocol-independent name resolution from an address to an ANSI host name and from a port number to the ANSI service name.
getpeername(SOCKET s, Pointer<SOCKADDR> name, Pointer<Int32> namelen) Win32Result<int> winsock
Retrieves the address of the peer to which a socket is connected.
getprotobyname(PCSTR name) Win32Result<Pointer<PROTOENT>> winsock
Retrieves the protocol information corresponding to a protocol name.
getprotobynumber(int number) Win32Result<Pointer<PROTOENT>> winsock
Retrieves protocol information corresponding to a protocol number.
getservbyname(PCSTR name, PCSTR? proto) Win32Result<Pointer<SERVENT>> winsock
Retrieves service information corresponding to a service name and protocol.
getservbyport(int port, PCSTR? proto) Win32Result<Pointer<SERVENT>> winsock
Retrieves service information corresponding to a port and protocol.
getsockname(SOCKET s, Pointer<SOCKADDR> name, Pointer<Int32> namelen) Win32Result<int> winsock
Retrieves the local name for a socket.
getsockopt(SOCKET s, int level, int optname, PSTR optval, Pointer<Int32> optlen) Win32Result<int> winsock
Retrieves a socket option.
htonl(int hostlong) Win32Result<int> winsock
Converts a u_long from host to TCP/IP network byte order (which is big-endian).
htons(int hostshort) Win32Result<int> winsock
Converts a u_short from host to TCP/IP network byte order (which is big-endian).
inet_ntop(int family, Pointer<NativeType> pAddr, PSTR pStringBuf, int stringBufSize) Win32Result<PCSTR> winsock
Converts an IPv4 or IPv6 Internet network address into a string in Internet standard format.
ioctlsocket(SOCKET s, int cmd, Pointer<Uint32> argp) Win32Result<int> winsock
Controls the I/O mode of a socket.
listen(SOCKET s, int backlog) Win32Result<int> winsock
Places a socket in a state in which it is listening for an incoming connection.
ntohl(int netlong) Win32Result<int> winsock
Converts a u_long from TCP/IP network order to host byte order, which is little-endian on Intel processors.
ntohs(int netshort) Win32Result<int> winsock
Converts a u_short from TCP/IP network byte order to host byte order, which is little-endian on Intel processors.
recv(SOCKET s, PSTR buf, int len, SEND_RECV_FLAGS flags) Win32Result<int> winsock
Receives data from a connected socket or a bound connectionless socket.
recvfrom(SOCKET s, PSTR buf, int len, int flags, Pointer<SOCKADDR>? from, Pointer<Int32>? fromlen) Win32Result<int> winsock
Receives a datagram and stores the source address.
select(int nfds, Pointer<FD_SET>? readfds, Pointer<FD_SET>? writefds, Pointer<FD_SET>? exceptfds, Pointer<TIMEVAL>? timeout) Win32Result<int> winsock
Determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.
send(SOCKET s, PCSTR buf, int len, SEND_RECV_FLAGS flags) Win32Result<int> winsock
Sends data on a connected socket.
sendto(SOCKET s, PCSTR buf, int len, int flags, Pointer<SOCKADDR> to, int tolen) Win32Result<int> winsock
Sends data to a specific destination.
shutdown(SOCKET s, WINSOCK_SHUTDOWN_HOW how) Win32Result<int> winsock
Disables sends or receives on a socket.
socket(int af, WINSOCK_SOCKET_TYPE type, int protocol) Win32Result<SOCKET> winsock
Creates a socket that is bound to a specific transport service provider.