core.sys.windows.winsock2

Types 32

aliasSOCKET = size_t
aliassocklen_t = int
structWSADATA
Fields
ushort wVersion
ushort wHighVersion
char[WSADESCRIPTION_LEN + 1] szDescription
char[WSASYS_STATUS_LEN + 1] szSystemStatus
ushort iMaxSockets
ushort iMaxUdpDg
char * lpVendorInfo
structfd_set_custom(uint SETSIZE)
Fields
uint fd_count
SOCKET[SETSIZE] fd_array
aliasfd_set = fd_set_custom!FD_SETSIZE
structlinger
Fields
ushort l_onoff
ushort l_linger
structprotoent
Fields
char * p_name
char * * p_aliases
short p_proto
structservent
Fields
char * s_name
char * * s_aliases
structtimeval
Fields
int tv_sec
int tv_usec
unionin_addr
Fields
_S_un_t S_un
uint s_addr
Nested Templates
unionin6_addr
Fields
_in6_u_t in6_u
ubyte[16] s6_addr8
ushort[8] s6_addr16
uint[4] s6_addr32
structsockaddr
Fields
short sa_family
ubyte[14] sa_data
aliasSOCKADDR = sockaddr
structsockaddr_storage
Fields
short ss_family
char[6] __ss_pad1
long __ss_align
char[112] __ss_pad2
aliasSOCKADDR_STORAGE = sockaddr_storage
structsockaddr_in
Fields
short sin_family
ushort sin_port
in_addr sin_addr
ubyte[8] sin_zero
aliasSOCKADDR_IN = sockaddr_in
structsockaddr_in6
Fields
short sin6_family
ushort sin6_port
uint sin6_flowinfo
in6_addr sin6_addr
uint sin6_scope_id
structaddrinfo
Fields
int ai_flags
int ai_family
int ai_socktype
int ai_protocol
size_t ai_addrlen
char * ai_canonname
sockaddr * ai_addr
addrinfo * ai_next
structhostent
Fields
char * h_name
char * * h_aliases
short h_addrtype
short h_length
char * * h_addr_list
Methods
char * h_addr() @safe pure nothrow @nogc
aliasLPWSAOVERLAPPED_COMPLETION_ROUTINE = void function(uint, uint, LPWSAOVERLAPPED, uint) nothrow @nogc
structtcp_keepalive
Fields
uint onoff
uint keepalivetime
uint keepaliveinterval
structpollfd
Fields
short events
short revents
aliasWSAPOLLFD = pollfd
aliasPWSAPOLLFD = pollfd *
aliasLPWSAPOLLFD = pollfd *

Functions 43

fnint WSAStartup(ushort wVersionRequested, LPWSADATA lpWSAData)
fnint WSACleanup() @trusted
fnSOCKET socket(int af, int type, int protocol) @trusted
fnint ioctlsocket(SOCKET s, int cmd, uint * argp)
fnint bind(SOCKET s, const(sockaddr) * name, socklen_t namelen)
fnint connect(SOCKET s, const(sockaddr) * name, socklen_t namelen)
fnint listen(SOCKET s, int backlog) @trusted
fnSOCKET accept(SOCKET s, sockaddr * addr, socklen_t * addrlen)
fnint closesocket(SOCKET s) @trusted
fnint shutdown(SOCKET s, int how) @trusted
fnint getpeername(SOCKET s, sockaddr * name, socklen_t * namelen)
fnint getsockname(SOCKET s, sockaddr * name, socklen_t * namelen)
fnint send(SOCKET s, const(void) * buf, int len, int flags)
fnint sendto(SOCKET s, const(void) * buf, int len, int flags, const(sockaddr) * to, socklen_t tolen)
fnint recv(SOCKET s, void * buf, int len, int flags)
fnint recvfrom(SOCKET s, void * buf, int len, int flags, sockaddr * from, socklen_t * fromlen)
fnint getsockopt(SOCKET s, int level, int optname, void * optval, socklen_t * optlen)
fnint setsockopt(SOCKET s, int level, int optname, const(void) * optval, socklen_t optlen)
fnuint inet_addr(const char * cp)
fnint select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, const(timeval) * timeout)
fnchar * inet_ntoa(in_addr ina)
fnhostent * gethostbyname(const char * name)
fnhostent * gethostbyaddr(const(void) * addr, int len, int type)
fnprotoent * getprotobyname(const char * name)
fnprotoent * getprotobynumber(int number)
fnservent * getservbyname(const char * name, const char * proto)
fnservent * getservbyport(int port, const char * proto)
fnint gethostname(const char * name, int namelen)
fnint getaddrinfo(const(char) * nodename, const(char) * servname, const(addrinfo) * hints, addrinfo * * res)
fnvoid freeaddrinfo(addrinfo * ai)
fnint getnameinfo(const(sockaddr) * sa, socklen_t salen, char * host, uint hostlen, char * serv, uint servlen, int flags)
fnint WSAGetLastError() @trusted @nogc
fnvoid FD_CLR(SOCKET fd, fd_set * set) pure @nogc
fnint FD_ISSET(SOCKET fd, const(fd_set) * set) pure @nogc
fnvoid FD_SET(SOCKET fd, fd_set * set) pure @nogc
fnvoid FD_ZERO(fd_set * set) pure @nogc
fnfd_set * FD_CREATE(uint capacity) pureCreates a new fd_set with the specified capacity.
fnushort htons(ushort x)
fnuint htonl(uint x)
fnushort ntohs(ushort x)
fnuint ntohl(uint x)
fnint WSAIoctl(SOCKET s, uint dwIoControlCode, void * lpvInBuffer, uint cbInBuffer, void * lpvOutBuffer, uint cbOutBuffer, uint * lpcbBytesReturned, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) @nogc
fnint WSAPoll(LPWSAPOLLFD fdArray, uint fds, int timeout) @nogc

Variables 17

enumvarINVALID_SOCKET = cast(SOCKET) ~ 0
enumvarSOCKET_ERROR = - 1
enumvarWSADESCRIPTION_LEN = 256
enumvarWSASYS_STATUS_LEN = 128
enumvarIOCPARM_MASK = 0x7F
enumvarIOC_IN = cast(int) 0x80000000
enumvarFIONBIO = cast(int)(IOC_IN | ((uint.sizeof & IOCPARM_MASK) << 16) | (102 << 8) | 126)
enumvarNI_MAXHOST = 1025
enumvarNI_MAXSERV = 32
enumvarWSABASEERR = 10000
enumvarFD_SETSIZE = 64

Default FD_SETSIZE value. In C/C++, it is redefinable by #define-ing the macro before #include-ing winsock.h. In D, use the FD_CREATE function to allocate a fd_set of an arbitrary size.

enumvarIN6ADDR_ANY = in6_addr
enumvarIN6ADDR_LOOPBACK = in6_addr
enumvarINET_ADDRSTRLEN = 16
enumvarINET6_ADDRSTRLEN = 46
enumvarIOC_VENDOR = 0x18000000
enumvarSIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4