Unit Winsock

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Author: François PIETTE, C.H.R. Citadelle EMail: francois.piette@ping.be http://www.rtfm.be/fpiette francois.piette@rtfm.be Creation: July 18, 1996 Object: Windows 16bit API Interface Unit for Delphi 1.x and compatible with Borland Delphi 2.x Winsock Support: Please ask your question in the following newsgroup: news://forums.borland.com/borland.public.delphi.vcl.components.using Legal issues: Copyright (C) 1997 by François PIETTE This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented, you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Updates: Sep 21, 1997 Added $IFDEF to warn Delphi 2 or 3 user that something is wrong if they use this file. Dec 13, 1997 Changed winsocket form 'WINSOCK.DLL' to 'WINSOCK' because Win 3.x like thos have it without extension (don't ask me why !) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Classes

Functions

accept - Socket function prototypes
bind -
closesocket -
connect -
gethostbyaddr -
gethostbyname -
gethostname -
getpeername -
getprotobyname -
getprotobynumber -
getservbyname -
getservbyport -
getsockname -
getsockopt -
htonl -
htons -
inet_addr -
inet_ntoa -
ioctlsocket -
listen -
ntohl -
ntohs -
recv -
recvfrom -
select -
send -
sendto -
setsockopt -
shutdown -
socket -
WSAAsyncGetHostByAddr -
WSAAsyncGetHostByName -
WSAAsyncGetProtoByName -
WSAAsyncGetProtoByNumber -
WSAAsyncGetServByName -
WSAAsyncGetServByPort -
WSAAsyncSelect -
WSACancelAsyncRequest -
WSACancelBlockingCall -
WSACleanup -
WSAGetAsyncBuflen -
WSAGetAsyncError -
WSAGetLastError -
WSAGetSelectError -
WSAGetSelectEvent -
WSAIsBlocking -
WSAMakeSelectReply -
WSAMakeSyncReply -
WSARecvEx -
WSASetBlockingHook -
WSASetLastError -
WSAStartup -
WSAUnhookBlockingHook -

Types

HostEnt
NetEnt
PFDSet
PHostEnt
PInAddr
PNetEnt
Pprotoent
Protoent
PServEnt
PSockAddrIn
PTimeVal
PWSADATA
ServEnt
short
SunB
SunW
TFDSet
TInAddr
TLinger
TSockAddr
TSockAddrIn
TSocket
TSockProto
TTimeVal
TWSADATA
u_char
u_int
u_long
u_short

Constants

AF_APPLETALK
AF_CCITT
AF_CHAOS
AF_DATAKIT
AF_DECnet
AF_DLI
AF_ECMA
AF_HYLINK
AF_IMPLINK
AF_INET
AF_ISO
AF_LAT
AF_MAX
AF_NETBIOS
AF_NS
AF_OSI
AF_PUP
AF_SNA
AF_UNIX
AF_UNSPEC
EADDRINUSE
EADDRNOTAVAIL
EAFNOSUPPORT
EALREADY
ECONNABORTED
ECONNREFUSED
ECONNRESET
EDESTADDRREQ
EDQUOT
EHOSTDOWN
EHOSTUNREACH
EINPROGRESS
EISCONN
ELOOP
EMSGSIZE
ENAMETOOLONG
ENETDOWN
ENETRESET
ENETUNREACH
ENOBUFS
ENOPROTOOPT
ENOTCONN
ENOTEMPTY
ENOTSOCK
EOPNOTSUPP
EPFNOSUPPORT
EPROCLIM
EPROTONOSUPPORT
EPROTOTYPE
EREMOTE
ESHUTDOWN
ESOCKTNOSUPPORT
ESTALE
ETIMEDOUT
ETOOMANYREFS
EUSERS
EWOULDBLOCK
FD_ACCEPT
FD_CLOSE
FD_CONNECT
FD_OOB
FD_READ
FD_SETSIZE
FD_WRITE
FIOASYNC
FIONBIO
FIONREAD
HOST_NOT_FOUND
IMPLINK_HIGHEXPER
IMPLINK_IP
IMPLINK_LOWEXPER
INADDR_ANY
INADDR_BROADCAST
INADDR_LOOPBACK
INADDR_NONE
INVALID_SOCKET
IOCPARM_MASK
IOC_IN
IOC_INOUT
IOC_OUT
IOC_VOID
IPPORT_ANY
IPPORT_BIFFUDP
IPPORT_CMDSERVER
IPPORT_DAYTIME
IPPORT_DISCARD
IPPORT_ECHO
IPPORT_EFSSERVER
IPPORT_EXECSERVER
IPPORT_FINGER
IPPORT_FTP
IPPORT_LOGINSERVER
IPPORT_MTP
IPPORT_NAMESERVER
IPPORT_NETSTAT
IPPORT_RESERVED
IPPORT_RJE
IPPORT_ROUTESERVER
IPPORT_SMTP
IPPORT_SUPDUP
IPPORT_SYSTAT
IPPORT_TELNET
IPPORT_TFTP
IPPORT_TIMESERVER
IPPORT_TTYLINK
IPPORT_WHOIS
IPPORT_WHOSERVER
IPPROTO_GGP
IPPROTO_ICMP
IPPROTO_IDP
IPPROTO_IP
IPPROTO_MAX
IPPROTO_ND
IPPROTO_PUP
IPPROTO_RAW
IPPROTO_TCP
IPPROTO_UDP
MAXGETHOSTSTRUCT
MSG_DONTROUTE
MSG_MAXIOVLEN
MSG_OOB
MSG_PEEK
NO_ADDRESS
NO_DATA
NO_RECOVERY
PF_APPLETALK
PF_CCITT
PF_CHAOS
PF_DATAKIT
PF_DECnet
PF_DLI
PF_ECMA
PF_HYLINK
PF_IMPLINK
PF_INET
PF_ISO
PF_LAT
PF_MAX
PF_NS
PF_OSI
PF_PUP
PF_SNA
PF_UNIX
PF_UNSPEC
SIOCATMARK
SIOCGHIWAT
SIOCGLOWAT
SIOCSHIWAT
SIOCSLOWAT
SOCKET_ERROR
SOCK_DGRAM
SOCK_RAW
SOCK_RDM
SOCK_SEQPACKET
SOCK_STREAM
SOL_SOCKET
SOMAXCONN
SO_ACCEPTCONN
SO_BROADCAST
SO_DEBUG
SO_DONTLINGER
SO_DONTROUTE
SO_ERROR
SO_KEEPALIVE
SO_LINGER
SO_OOBINLINE
SO_RCVBUF
SO_RCVLOWAT
SO_RCVTIMEO
SO_REUSEADDR
SO_SNDBUF
SO_SNDLOWAT
SO_SNDTIMEO
SO_TYPE
SO_USELOOPBACK
TCP_NODELAY
TRY_AGAIN
winsocket
WSABASEERR
WSADESCRIPTION_LEN
WSAEACCES
WSAEADDRINUSE
WSAEADDRNOTAVAIL
WSAEAFNOSUPPORT
WSAEALREADY
WSAEBADF
WSAECONNABORTED
WSAECONNREFUSED
WSAECONNRESET
WSAEDESTADDRREQ
WSAEDQUOT
WSAEFAULT
WSAEHOSTDOWN
WSAEHOSTUNREACH
WSAEINPROGRESS
WSAEINTR
WSAEINVAL
WSAEISCONN
WSAELOOP
WSAEMFILE
WSAEMSGSIZE
WSAENAMETOOLONG
WSAENETDOWN
WSAENETRESET
WSAENETUNREACH
WSAENOBUFS
WSAENOPROTOOPT
WSAENOTCONN
WSAENOTEMPTY
WSAENOTSOCK
WSAEOPNOTSUPP
WSAEPFNOSUPPORT
WSAEPROCLIM
WSAEPROTONOSUPPORT
WSAEPROTOTYPE
WSAEREMOTE
WSAESHUTDOWN
WSAESOCKTNOSUPPORT
WSAESTALE
WSAETIMEDOUT
WSAETOOMANYREFS
WSAEUSERS
WSAEWOULDBLOCK
WSAHOST_NOT_FOUND
WSANOTINITIALISED
WSANO_ADDRESS
WSANO_DATA
WSANO_RECOVERY
WSASYSNOTREADY
WSASYS_STATUS_LEN
WSATRY_AGAIN
WSAVERNOTSUPPORTED

Variables


Functions


function accept(s: TSocket; var addr: TSockAddr; var addrlen: Integer): TSocket;

Socket function prototypes

function bind(s: TSocket; var addr: TSockAddr; namelen: Integer): Integer;


function closesocket(s: TSocket): Integer;


function connect(s: TSocket; var name: TSockAddr; namelen: Integer): Integer;


function gethostbyaddr(addr: Pointer; len, struct: Integer): PHostEnt;


function gethostbyname(name: PChar): PHostEnt;


function gethostname(name: PChar; len: Integer): Integer;


function getpeername(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer;


function getprotobyname(name: PChar): PProtoEnt;


function getprotobynumber(proto: Integer): PProtoEnt;


function getservbyname(name, proto: PChar): PServEnt;


function getservbyport(port: Integer; proto: PChar): PServEnt;


function getsockname(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer;


function getsockopt(s: TSocket; level, optname: Integer; optval: PChar; var optlen: Integer): Integer;


function htonl(hostlong: u_long): u_long;


function htons(hostshort: u_short): u_short;


function inet_addr(cp: PChar): u_long;


function inet_ntoa(inaddr: TInAddr): PChar;


function ioctlsocket(s: TSocket; cmd: Longint; var arg: u_long): Integer;


function listen(s: TSocket; backlog: Integer): Integer;


function ntohl(netlong: u_long): u_long;


function ntohs(netshort: u_short): u_short;


function recv(s: TSocket; var Buf; len, flags: Integer): Integer;


function recvfrom(s: TSocket; var Buf; len, flags: Integer; var from: TSockAddr; var fromlen: Integer): Integer;


function select(nfds: Integer; readfds, writefds, exceptfds: PFDSet; timeout: PTimeVal): Longint;


function send(s: TSocket; var Buf; len, flags: Integer): Integer;


function sendto(s: TSocket; var Buf; len, flags: Integer; var addrto: TSockAddr; tolen: Integer): Integer;


function setsockopt(s: TSocket; level, optname: Integer; optval: PChar; optlen: Integer): Integer;


function shutdown(s: TSocket; how: Integer): Integer;


function socket(af, struct, protocol: Integer): TSocket;


function WSAAsyncGetHostByAddr(HWindow: HWND; wMsg: u_int; addr: PChar; len, struct: Integer; buf: PChar; buflen: Integer): THandle;


function WSAAsyncGetHostByName(HWindow: HWND; wMsg: u_int; name, buf: PChar; buflen: Integer): THandle;


function WSAAsyncGetProtoByName(HWindow: HWND; wMsg: u_int; name, buf: PChar; buflen: Integer): THandle;


function WSAAsyncGetProtoByNumber(HWindow: HWND; wMsg: u_int; number: Integer; buf: PChar; buflen: Integer): THandle;


function WSAAsyncGetServByName(HWindow: HWND; wMsg: u_int; name, proto, buf: PChar; buflen: Integer): THandle;


function WSAAsyncGetServByPort( HWindow: HWND; wMsg, port: u_int; proto, buf: PChar; buflen: Integer): THandle;


function WSAAsyncSelect(s: TSocket; HWindow: HWND; wMsg: u_int; lEvent: Longint): Integer;


function WSACancelAsyncRequest(hAsyncTaskHandle: THandle): Integer;


function WSACancelBlockingCall: Integer;


function WSACleanup: Integer;


function WSAGetAsyncBuflen(Param: Longint): Word;


function WSAGetAsyncError(Param: Longint): Word;


function WSAGetLastError: Integer;


function WSAGetSelectError(Param: Longint): Word;


function WSAGetSelectEvent(Param: Longint): Word;


function WSAIsBlocking: BOOL;


function WSAMakeSelectReply(Event, Error: Word): Longint;


function WSAMakeSyncReply(Buflen, Error: Word): Longint;


function WSARecvEx(s: TSocket; var buf; len: Integer; var flags: Integer): Integer;


function WSASetBlockingHook(lpBlockFunc: TFarProc): TFarProc;


procedure WSASetLastError(iError: Integer);


function WSAStartup(wVersionRequired: word; var WSData: TWSAData): Integer;


function WSAUnhookBlockingHook: Integer;


Types


HostEnt = record
h_name : PChar;
h_aliases : ^PChar;
h_addrtype : short;
h_length : short;
h_addr_list : ^PChar;
end;
Structures returned by network data base library, taken from the BSD file netdb.h. All addresses are supplied in host order, and returned in network order (suitable for use in system calls).
NetEnt = record
n_name : PChar;
n_aliases : ^PChar;
n_addrtype : short;
n_net : u_long;
end;

PFDSet = ^TFDSet

PHostEnt = ^HostEnt
list of addresses
PInAddr = ^TInAddr

PNetEnt = ^NetEnt
network #
Pprotoent = ^protoent
protocol #
Protoent = record
p_name : PChar;
p_aliases : ^PChar;
p_proto : integer;
end;

PServEnt = ^ServEnt
protocol to use
PSockAddrIn = ^TSockAddrIn

PTimeVal = ^TTimeVal

PWSADATA = ^TWSADATA

ServEnt = record
s_name : PChar;
s_aliases : ^PChar;
s_port : integer;
s_proto : PChar;
end;

short    = word

SunB = record
s_b1 : u_char;
s_b2 : u_char;
s_b3 : u_char;
s_b4 : u_char;
end;
Internet address (old style... should be updated)
SunW = record
s_w1 : u_short;
s_w2 : u_short;
end;

TFDSet = record
fd_count : u_short;
fd_array : array [0..(FD_SETSIZE - 1)] of TSocket;
end;
Select uses arrays of SOCKETs.
TInAddr = record
end;

TLinger = record
l_onoff : u_short;
l_linger : u_short;
end;
Structure used for manipulating linger option.
TSockAddr   = TSockAddrIn

TSockAddrIn = record
end;
Socket address, internet style.
TSocket = u_int
low level handle wich refer to sockets
TSockProto = record
sp_family : u_short;
sp_protocol : u_short;
end;
Structure used by kernel to pass protocol information in raw sockets.
TTimeVal = record
tv_sec : longint;
tv_usec : longint;
end;
Structure used in select() call, taken from the BSD file sys/time.h.
TWSADATA = record
wVersion : word;
wHighVersion : word;
szDescription : array [0..WSADESCRIPTION_LEN] of char;
szSystemStatus : array [0..WSASYS_STATUS_LEN] of char;
iMaxSockets : u_short;
iMaxUdpDg : u_short;
lpVendorInfo : PChar;
end;

u_char   = byte
Basic system type definitions, taken from the BSD file sys/types.h.
u_int    = word

u_long   = longint

u_short  = word

Constants

AF_APPLETALK = 16

NSC Hyperchannel

AF_CCITT = 10

datakit protocols

AF_CHAOS = 5

pup protocols: e.g. BSP

AF_DATAKIT = 9

european computer manufacturers

AF_DECnet = 12

IBM SNA

AF_DLI = 13

DECnet

AF_ECMA = 8

OSI is ISO

AF_HYLINK = 15

LAT

AF_IMPLINK = 3

internetwork: UDP, TCP, etc.

AF_INET = 2

local to host (pipes, portals)

AF_ISO = 7

XEROX NS protocols

AF_LAT = 14

Direct data link interface

AF_MAX = 18

NetBios-style addresses

AF_NETBIOS = 17

AppleTalk

AF_NS = 6

mit CHAOS protocols

AF_OSI = AF_ISO

ISO protocols

AF_PUP = 4

arpanet imp addresses

AF_SNA = 11

CCITT protocols, X.25 etc

AF_UNIX = 1

unspecified

AF_UNSPEC = 0

Address families

EADDRINUSE = WSAEADDRINUSE

EADDRNOTAVAIL = WSAEADDRNOTAVAIL

EAFNOSUPPORT = WSAEAFNOSUPPORT

EALREADY = WSAEALREADY

ECONNABORTED = WSAECONNABORTED

ECONNREFUSED = WSAECONNREFUSED

ECONNRESET = WSAECONNRESET

EDESTADDRREQ = WSAEDESTADDRREQ

EDQUOT = WSAEDQUOT

EHOSTDOWN = WSAEHOSTDOWN

EHOSTUNREACH = WSAEHOSTUNREACH

EINPROGRESS = WSAEINPROGRESS

EISCONN = WSAEISCONN

ELOOP = WSAELOOP

EMSGSIZE = WSAEMSGSIZE

ENAMETOOLONG = WSAENAMETOOLONG

ENETDOWN = WSAENETDOWN

ENETRESET = WSAENETRESET

ENETUNREACH = WSAENETUNREACH

ENOBUFS = WSAENOBUFS

ENOPROTOOPT = WSAENOPROTOOPT

ENOTCONN = WSAENOTCONN

ENOTEMPTY = WSAENOTEMPTY

ENOTSOCK = WSAENOTSOCK

EOPNOTSUPP = WSAEOPNOTSUPP

EPFNOSUPPORT = WSAEPFNOSUPPORT

EPROCLIM = WSAEPROCLIM

EPROTONOSUPPORT = WSAEPROTONOSUPPORT

EPROTOTYPE = WSAEPROTOTYPE

EREMOTE = WSAEREMOTE

ESHUTDOWN = WSAESHUTDOWN

ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT

ESTALE = WSAESTALE

ETIMEDOUT = WSAETIMEDOUT

ETOOMANYREFS = WSAETOOMANYREFS

EUSERS = WSAEUSERS

EWOULDBLOCK = WSAEWOULDBLOCK

Windows Sockets errors redefined as regular Berkeley error constants

FD_ACCEPT = 8

FD_CLOSE = 32

FD_CONNECT = 16

FD_OOB = 4

FD_READ = 1

Define flags to be used with the WSAAsyncSelect() call

FD_SETSIZE = 64

If your application can't find winsock.dll on startup, please try to } { change the preceding line to "winsocket = 'winsock.dll';" } { Also, try upper or lower case letters. Win 3.x is very capricious ! } { Misc constants

FD_WRITE = 2

FIOASYNC = $8004667D

set/clear non-blocking i/o

FIONBIO = $8004667E

get # bytes to read

FIONREAD = $4004667F

HOST_NOT_FOUND = WSAHOST_NOT_FOUND

IMPLINK_HIGHEXPER = 158

IMPLINK_IP = 155

Link numbers

IMPLINK_LOWEXPER = 156

INADDR_ANY = $00000000

at oob mark?

INADDR_BROADCAST = $ffffffff

INADDR_LOOPBACK = $7f000001

INADDR_NONE = $ffffffff

INVALID_SOCKET = $ffff

IOCPARM_MASK = $7f

Commands for ioctlsocket(), taken from the BSD file fcntl.h. Ioctl's have the command encoded in the lower word, and the size of any in or out parameters in the upper word. The high 2 bits of the upper word are used to encode the in/out status of the parameter; for now we restrict parameters to at most 128 bytes. 0x20000000 distinguishes new & old ioctl's

IOC_IN = $80000000

copy out parameters

IOC_INOUT = (IOC_IN + IOC_OUT)

copy in parameters

IOC_OUT = $40000000

no parameters

IOC_VOID = $20000000

parameters must be < 128 bytes

IPPORT_ANY = 0

Port/socket numbers: network standard functions

IPPORT_BIFFUDP = 512

UNIX UDP sockets

IPPORT_CMDSERVER = 514

IPPORT_DAYTIME = 13

IPPORT_DISCARD = 9

IPPORT_ECHO = 7

IPPORT_EFSSERVER = 520

IPPORT_EXECSERVER = 512

UNIX TCP sockets

IPPORT_FINGER = 79

IPPORT_FTP = 21

IPPORT_LOGINSERVER = 513

IPPORT_MTP = 57

IPPORT_NAMESERVER = 42

IPPORT_NETSTAT = 15

IPPORT_RESERVED = 1024

Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root)

IPPORT_RJE = 77

IPPORT_ROUTESERVER = 520

IPPORT_SMTP = 25

IPPORT_SUPDUP = 95

IPPORT_SYSTAT = 11

IPPORT_TELNET = 23

IPPORT_TFTP = 69

Port/socket numbers: host specific functions

IPPORT_TIMESERVER = 37

IPPORT_TTYLINK = 87

IPPORT_WHOIS = 43

IPPORT_WHOSERVER = 513

IPPROTO_GGP = 2

control message protocol

IPPROTO_ICMP = 1

dummy for IP

IPPROTO_IDP = 22

user datagram protocol

IPPROTO_IP = 0

Protocols

IPPROTO_MAX = 256

raw IP packet

IPPROTO_ND = 77

xns idp

IPPROTO_PUP = 12

tcp

IPPROTO_RAW = 255

UNOFFICIAL net disk proto

IPPROTO_TCP = 6

gateway^2 (deprecated)

IPPROTO_UDP = 17

pup

MAXGETHOSTSTRUCT = 1024

Define constant based on rfc883, used by gethostbyxxxx() calls

MSG_DONTROUTE = 4

peek at incoming message

MSG_MAXIOVLEN = 16

send without using routing tables

MSG_OOB = 1

MSG_PEEK = 2

process out-of-band data

NO_ADDRESS = WSANO_ADDRESS

NO_DATA = WSANO_DATA

NO_RECOVERY = WSANO_RECOVERY

PF_APPLETALK = AF_APPLETALK

PF_CCITT = AF_CCITT

PF_CHAOS = AF_CHAOS

PF_DATAKIT = AF_DATAKIT

PF_DECnet = AF_DECnet

PF_DLI = AF_DLI

PF_ECMA = AF_ECMA

PF_HYLINK = AF_HYLINK

PF_IMPLINK = AF_IMPLINK

PF_INET = AF_INET

PF_ISO = AF_ISO

PF_LAT = AF_LAT

PF_MAX = AF_MAX

PF_NS = AF_NS

PF_OSI = AF_OSI

PF_PUP = AF_PUP

PF_SNA = AF_SNA

PF_UNIX = AF_UNIX

PF_UNSPEC = AF_UNSPEC

Protocol families, same as address families for now

SIOCATMARK = $40047307

get low watermark

SIOCGHIWAT = $40047301

set high watermark

SIOCGLOWAT = $40047303

set low watermark

SIOCSHIWAT = $80047300

set/clear async i/o } { Socket I/O Controls

SIOCSLOWAT = $80047302

set low watermark

SOCKET_ERROR = (-1)

SOCK_DGRAM = 2

stream socket

SOCK_RAW = 3

datagram socket

SOCK_RDM = 4

raw-protocol interface

SOCK_SEQPACKET = 5

reliably-delivered message

SOCK_STREAM = 1

Types

SOL_SOCKET = -1

Level number for (get/set)sockopt() to apply to socket itself

SOMAXCONN = 5

options for socket level } { Maximum queue length specifiable by listen

SO_ACCEPTCONN = $0002

turn on debugging info recording

SO_BROADCAST = $0020

just use interface addresses

SO_DEBUG = $0001

sequenced packet stream } { Option flags per-socket

SO_DONTLINGER = (not SO_LINGER)

leave received OOB data in line

SO_DONTROUTE = $0010

keep connections alive

SO_ERROR = $1007

receive timeout

SO_KEEPALIVE = $0008

allow local address reuse

SO_LINGER = $0080

bypass hardware when possible

SO_OOBINLINE = $0100

linger on close if data present

SO_RCVBUF = $1002

send buffer size

SO_RCVLOWAT = $1004

send low-water mark

SO_RCVTIMEO = $1006

send timeout

SO_REUSEADDR = $0004

socket has had listen()

SO_SNDBUF = $1001

Additional options

SO_SNDLOWAT = $1003

receive buffer size

SO_SNDTIMEO = $1005

receive low-water mark

SO_TYPE = $1008

get error status and clear

SO_USELOOPBACK = $0040

permit sending of broadcast msgs

TCP_NODELAY = $0001

get socket type } { TCP options

TRY_AGAIN = WSATRY_AGAIN

winsocket = 'WINSOCK'

WSABASEERR = 10000

All Windows Sockets error constants are biased by WSABASEERR fromthe normal

WSADESCRIPTION_LEN = 256

WSAEACCES = (WSABASEERR+13)

WSAEADDRINUSE = (WSABASEERR+48)

WSAEADDRNOTAVAIL = (WSABASEERR+49)

WSAEAFNOSUPPORT = (WSABASEERR+47)

WSAEALREADY = (WSABASEERR+37)

WSAEBADF = (WSABASEERR+9)

WSAECONNABORTED = (WSABASEERR+53)

WSAECONNREFUSED = (WSABASEERR+61)

WSAECONNRESET = (WSABASEERR+54)

WSAEDESTADDRREQ = (WSABASEERR+39)

WSAEDQUOT = (WSABASEERR+69)

WSAEFAULT = (WSABASEERR+14)

WSAEHOSTDOWN = (WSABASEERR+64)

WSAEHOSTUNREACH = (WSABASEERR+65)

WSAEINPROGRESS = (WSABASEERR+36)

WSAEINTR = (WSABASEERR+4)

Windows Sockets definitions of regular Microsoft C error constants

WSAEINVAL = (WSABASEERR+22)

WSAEISCONN = (WSABASEERR+56)

WSAELOOP = (WSABASEERR+62)

WSAEMFILE = (WSABASEERR+24)

WSAEMSGSIZE = (WSABASEERR+40)

WSAENAMETOOLONG = (WSABASEERR+63)

WSAENETDOWN = (WSABASEERR+50)

WSAENETRESET = (WSABASEERR+52)

WSAENETUNREACH = (WSABASEERR+51)

WSAENOBUFS = (WSABASEERR+55)

WSAENOPROTOOPT = (WSABASEERR+42)

WSAENOTCONN = (WSABASEERR+57)

WSAENOTEMPTY = (WSABASEERR+66)

WSAENOTSOCK = (WSABASEERR+38)

WSAEOPNOTSUPP = (WSABASEERR+45)

WSAEPFNOSUPPORT = (WSABASEERR+46)

WSAEPROCLIM = (WSABASEERR+67)

WSAEPROTONOSUPPORT = (WSABASEERR+43)

WSAEPROTOTYPE = (WSABASEERR+41)

WSAEREMOTE = (WSABASEERR+71)

WSAESHUTDOWN = (WSABASEERR+58)

WSAESOCKTNOSUPPORT = (WSABASEERR+44)

WSAESTALE = (WSABASEERR+70)

WSAETIMEDOUT = (WSABASEERR+60)

WSAETOOMANYREFS = (WSABASEERR+59)

WSAEUSERS = (WSABASEERR+68)

WSAEWOULDBLOCK = (WSABASEERR+35)

Windows Sockets definitions of regular Berkeley error constants

WSAHOST_NOT_FOUND = (WSABASEERR+1001)

Authoritative Answer: Host not found

WSANOTINITIALISED = (WSABASEERR+93)

WSANO_ADDRESS = WSANO_DATA

no address, look for MX record

WSANO_DATA = (WSABASEERR+1004)

Valid name, no data record of requested type

WSANO_RECOVERY = (WSABASEERR+1003)

Non recoverable errors, FORMERR, REFUSED, NOTIMP

WSASYSNOTREADY = (WSABASEERR+91)

Extended Windows Sockets error constant definitions

WSASYS_STATUS_LEN = 128

WSATRY_AGAIN = (WSABASEERR+1002)

Non-Authoritative: Host not found, or SERVERFAIL

WSAVERNOTSUPPORTED = (WSABASEERR+92)


Variables