Difference between revisions of "Unit GlobalSock"

From Ultibo.org
Jump to: navigation, search
Line 12: Line 12:
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Global socket constants''' <code> FD_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>FD_SETSIZE = 64;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>IOCPARM_MASK = $7f;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IOC_VOID = $20000000;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IOC_OUT = $40000000;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IOC_IN = $80000000;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IOC_INOUT = (IOC_IN or IOC_OUT);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FIONREAD = Cardinal( IOC_OUT or</code>
 +
| get # bytes to read
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (102 shl 8) or 127);</code>
 +
| &nbsp;
 +
|-
 +
| <code>FIONBIO = Cardinal(IOC_IN or</code>
 +
| set/clear non-blocking i/o
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (102 shl 8) or 126);</code>
 +
| &nbsp;
 +
|-
 +
| <code>FIOASYNC = Cardinal(IOC_IN or</code>
 +
| set/clear async i/o
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (102 shl 8) or 125);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>SIOCSHIWAT = Cardinal( IOC_IN or</code>
 +
| set high watermark
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>SIOCGHIWAT = Cardinal( IOC_OUT or</code>
 +
| get high watermark
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 1);</code>
 +
| &nbsp;
 +
|-
 +
| <code>SIOCSLOWAT = Cardinal( IOC_IN or</code>
 +
| set low watermark
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>SIOCGLOWAT = Cardinal( IOC_OUT or</code>
 +
| get low watermark
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 3);</code>
 +
| &nbsp;
 +
|-
 +
| <code>SIOCATMARK = Cardinal( IOC_OUT or</code>
 +
| at oob mark
 +
|-
 +
| <code>((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 7);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp; 
 +
|-
 +
| <code>IMPLINK_IP = 155;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IMPLINK_LOWEXPER = 156;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IMPLINK_HIGHEXPER = 158;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>TF_DISCONNECT = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TF_REUSE_SOCKET = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TF_WRITE_BEHIND = $04;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp; 
 +
|-
 +
| <code>INVALID_SOCKET = TSocket(NOT(0));</code>
 +
| This is used instead of -1, since the TSocket type is unsigned.
 +
|-
 +
| <code>SOCKET_ERROR = -1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Level number for (get/set)sockopt() to apply to socket itself''
 +
|-
 +
| <code>SOL_SOCKET = $ffff;</code>
 +
| options for socket level
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Maximum queue length specifiable by listen''
 +
|-
 +
| <code>SOMAXCONN = 5;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Define constant based on rfc883, used by gethostbyxxxx() calls''
 +
|-
 +
| <code>MAXGETHOSTSTRUCT = 1024;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Define flags to be used with the WSAAsyncSelect() call''
 +
|-
 +
| <code>FD_READ = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FD_WRITE = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FD_OOB = $04;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FD_ACCEPT = $08;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FD_CONNECT = $10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FD_CLOSE = $20;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSADESCRIPTION_LEN = 256;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSASYS_STATUS_LEN = 128;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Global Socket constants for enhanced Winsock functions''
 +
|-
 +
| <code>MAX_NAME_SIZE = 80;</code>
 +
| &nbsp;
 +
|-
 +
| <code>MAX_NAME_ALIASES = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>MAX_NAME_SERVERS = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>MAX_HOST_ALIASES = 16;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>INET_ADDRSTR_ANY = '0.0.0.0';</code>
 +
| &nbsp;
 +
|-
 +
| <code>INET6_ADDRSTR_INIT = '0::0';</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>INET_ADDRSTR_BROADCAST = '255.255.255.255';</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>INET_ADDRSTRLEN = 16;</code>
 +
| Max size of numeric form of IPv4 address
 +
|-
 +
| <code>INET6_ADDRSTRLEN = 46;</code>
 +
| Max size of numeric form of IPv6 address
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''IP protocol constants''' <code> IPPROTO_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>IPPROTO_IP = 0;</code>
 +
| dummy for IP
 +
|-
 +
| <code>IPPROTO_ICMP = 1;</code>
 +
| control message protocol
 +
|-
 +
| <code>IPPROTO_IGMP = 2;</code>
 +
| group management protocol
 +
|-
 +
| <code>IPPROTO_GGP = 3;</code>
 +
| gateway^2 (deprecated)
 +
|-
 +
| <code>IPPROTO_TCP = 6;</code>
 +
| tcp
 +
|-
 +
| <code>IPPROTO_EGP = 8;</code>
 +
| egp
 +
|-
 +
| <code>IPPROTO_PUP =12;</code>
 +
| pup
 +
|-
 +
| <code>IPPROTO_UDP =17;</code>
 +
| user datagram protocol
 +
|-
 +
| <code>IPPROTO_HMP =20;</code>
 +
| hmp
 +
|-
 +
| <code>IPPROTO_IDP =22;</code>
 +
| xns idp
 +
|-
 +
| <code>IPPROTO_RDP =27;</code>
 +
| rdp
 +
|-
 +
| <code>IPPROTO_IPV6 = 41;</code>
 +
| IP6 header
 +
|-
 +
| <code>IPPROTO_ROUTING = 43;</code>
 +
| IP6 routing header
 +
|-
 +
| <code>IPPROTO_FRAGMENT = 44;</code>
 +
| IP6 fragmentation header
 +
|-
 +
| <code>IPPROTO_ICMPV6 = 58;</code>
 +
| ICMP6
 +
|-
 +
| <code>IPPROTO_RVD = 66;</code>
 +
| rvd
 +
|-
 +
| <code>IPPROTO_ND = 77;</code>
 +
| UNOFFICIAL net disk proto
 +
|-
 +
| <code>IPPROTO_RAW = 255;</code>
 +
| raw IP packet
 +
|-
 +
| <code>IPPROTO_MAX = 256;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>NSPROTO_IPX = 1000;</code>
 +
| ipx protocol
 +
|-
 +
| <code>NSPROTO_SPX = 1256;</code>
 +
| spx protocol
 +
|-
 +
| <code>NSPROTO_SPXII = 1257;</code>
 +
| spxii protocol
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''IP port constants ''' <code> IPPORT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Port/socket numbers: network standard functions''
 +
|-
 +
| <code>IPPORT_ANY = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>IPPORT_ECHO = 7;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_DISCARD = 9;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_SYSTAT = 11;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_DAYTIME = 13;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_NETSTAT = 15;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_FTP = 21;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_TELNET = 23;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_SMTP = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_TIMESERVER = 37;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_NAMESERVER = 42;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_WHOIS = 43;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_DNS = 53;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_MTP = 57;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_BOOTPS = 67;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_BOOTPC = 68;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Port/socket numbers: host specific functions''
 +
|-
 +
| <code>IPPORT_TFTP = 69;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_RJE = 77;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_FINGER = 79;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_TTYLINK = 87;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_SUPDUP = 95;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''UNIX TCP sockets''
 +
|-
 +
| <code>IPPORT_EXECSERVER = 512;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_LOGINSERVER = 513;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_CMDSERVER = 514;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_EFSSERVER = 520;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''UNIX UDP sockets''
 +
|-
 +
| <code>IPPORT_BIFFUDP = 512;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_WHOSERVER = 513;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IPPORT_ROUTESERVER = 520;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root)''
 +
|-
 +
| <code>IPPORT_RESERVED = 1024;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''IP options constants''' <code> IP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Options for use with [gs]etsockopt at the IP level
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>IP_OPTIONS = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>IP_MULTICAST_IF = 2;</code>
 +
| set/get IP multicast interface
 +
|-
 +
| <code>IP_MULTICAST_TTL = 3;</code>
 +
| set/get IP multicast timetolive
 +
|-
 +
| <code>IP_MULTICAST_LOOP  = 4;</code>
 +
| set/get IP multicast loopback
 +
|-
 +
| <code>IP_ADD_MEMBERSHIP = 5;</code>
 +
| add an IP group membership
 +
|-
 +
| <code>IP_DROP_MEMBERSHIP = 6;</code>
 +
| drop an IP group membership
 +
|-
 +
| <code>IP_TTL = 7;</code>
 +
| set/get IP Time To Live
 +
|-
 +
| <code>IP_TOS = 8;</code>
 +
| set/get IP Type Of Service
 +
|-
 +
| <code>IP_DONTFRAGMENT = 9;</code>
 +
| set/get IP Don't Fragment flag
 +
|-
 +
| <code>IP_HDRINCL = 10;</code>
 +
| set/get IP Header include
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>IP_DEFAULT_MULTICAST_TTL = 1;</code>
 +
| normally limit m'casts to 1 hop
 +
|-
 +
| <code>IP_DEFAULT_MULTICAST_LOOP = 1;</code>
 +
| normally hear sends if a member
 +
|-
 +
| <code>IP_MAX_MEMBERSHIPS = 20;</code>
 +
| per socket; must fit in one mbuf
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Socket type constants''' <code> SOCK_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SOCK_UNSPEC = 0;</code>
 +
| unspecified
 +
|-
 +
| <code>SOCK_STREAM = 1;</code>
 +
| stream socket
 +
|-
 +
| <code>SOCK_DGRAM = 2;</code>
 +
| datagram socket
 +
|-
 +
| <code>SOCK_RAW = 3;</code>
 +
| raw-protocol interface
 +
|-
 +
| <code>SOCK_RDM = 4;</code>
 +
| reliably-delivered message
 +
|-
 +
| <code>SOCK_SEQPACKET = 5;</code>
 +
| sequenced packet stream
 +
|-
 +
| <code>SOCK_PACKET = 10;</code>
 +
| linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Socket option constants''' <code> SO_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Option flags per-socket
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>SO_DEBUG = $0001;</code>
 +
| turn on debugging info recording
 +
|-
 +
| <code>SO_ACCEPTCONN = $0002;</code>
 +
| socket has had listen()
 +
|-
 +
| <code>SO_REUSEADDR = $0004;</code>
 +
| allow local address reuse
 +
|-
 +
| <code>SO_KEEPALIVE = $0008;</code>
 +
| keep connections alive
 +
|-
 +
| <code>SO_DONTROUTE = $0010;</code>
 +
| just use interface addresses
 +
|-
 +
| <code>SO_BROADCAST = $0020;</code>
 +
| permit sending of broadcast msgs
 +
|-
 +
| <code>SO_USELOOPBACK  = $0040;</code>
 +
| bypass hardware when possible
 +
|-
 +
| <code>SO_LINGER = $0080;</code>
 +
| linger on close if data present
 +
|-
 +
| <code>SO_OOBINLINE = $0100;</code>
 +
| leave received OOB data in line
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>SO_DONTLINGER = $ff7f;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Additional options''
 +
|-
 +
| <code>SO_SNDBUF = $1001;</code>
 +
| send buffer size
 +
|-
 +
| <code>SO_RCVBUF = $1002;</code>
 +
| receive buffer size
 +
|-
 +
| <code>SO_SNDLOWAT = $1003;</code>
 +
| send low-water mark
 +
|-
 +
| <code>SO_RCVLOWAT = $1004;</code>
 +
| receive low-water mark
 +
|-
 +
| <code>SO_SNDTIMEO = $1005;</code>
 +
| send timeout
 +
|-
 +
| <code>SO_RCVTIMEO = $1006;</code>
 +
| receive timeout
 +
|-
 +
| <code>SO_ERROR = $1007;</code>
 +
| get error status and clear
 +
|-
 +
| <code>SO_TYPE = $1008;</code>
 +
| get socket type
 +
|-
 +
| <code>SO_CONNTIMEO = $1009;</code>
 +
| connection timeout
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Options for connect and disconnect data and options. Used only by non-TCP/IP transports such as DECNet, OSI TP4, etc'.'
 +
|-
 +
| <code>SO_CONNDATA = $7000;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_CONNOPT = $7001;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_DISCDATA = $7002;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_DISCOPT = $7003;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_CONNDATALEN = $7004;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_CONNOPTLEN = $7005;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_DISCDATALEN = $7006;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_DISCOPTLEN = $7007;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Option for opening sockets for synchronous access''
 +
|-
 +
| <code>SO_OPENTYPE = $7008;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_SYNCHRONOUS_ALERT = $10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_SYNCHRONOUS_NONALERT = $20;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Other NT-specific options''
 +
|-
 +
| <code>SO_MAXDG = $7009;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_MAXPATHDG = $700A;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_UPDATE_ACCEPT_CONTEXT = $700B;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SO_CONNECT_TIME = $700C;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''TCP option constants''' <code> TCP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TCP_NODELAY = $0001;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TCP_MAXSEG = $0002;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TCP_NOPUSH = $0004;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TCP_NOOPT = $0008;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TCP_BSDURGENT = $7000;</code>
 +
| Implement BSD Urgent instead of RFC793/1122
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>TCP_WSCALE = $0010;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TCP_NOSACK = $0020;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''UDP option constants''' <code> UDP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>UDP_NOCHECKSUM = $0001;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Address family constants''' <code> AF_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AF_UNSPEC = 0;</code>
 +
| unspecified
 +
|-
 +
| <code>AF_UNIX = 1;</code>
 +
| local to host (pipes, portals)
 +
|-
 +
| <code>AF_INET = 2;</code>
 +
| internetwork: UDP, TCP, etc.
 +
|-
 +
| <code>AF_IMPLINK = 3;</code>
 +
| arpanet imp addresses
 +
|-
 +
| <code>AF_PUP = 4;</code>
 +
| pup protocols: e.g. BSP
 +
|-
 +
| <code>AF_CHAOS = 5;</code>
 +
| mit CHAOS protocols
 +
|-
 +
| <code>AF_IPX = 6;</code>
 +
| IPX and SPX
 +
|-
 +
| <code>AF_NS = 6;</code>
 +
| XEROX NS protocols
 +
|-
 +
| <code>AF_ISO = 7;</code>
 +
| ISO protocols
 +
|-
 +
| <code>AF_OSI = AF_ISO;</code>
 +
| OSI is ISO
 +
|-
 +
| <code>AF_ECMA = 8;</code>
 +
| european computer manufacturers
 +
|-
 +
| <code>AF_DATAKIT = 9;</code>
 +
| datakit protocols
 +
|-
 +
| <code>AF_CCITT = 10;</code>
 +
| CCITT protocols, X.25 etc
 +
|-
 +
| <code>AF_SNA = 11;</code>
 +
| IBM SNA
 +
|-
 +
| <code>AF_DECnet = 12;</code>
 +
| DECnet
 +
|-
 +
| <code>AF_DLI = 13;</code>
 +
| Direct data link interface
 +
|-
 +
| <code>AF_LAT = 14;</code>
 +
| LAT
 +
|-
 +
| <code>AF_HYLINK = 15;</code>
 +
| NSC Hyperchannel
 +
|-
 +
| <code>AF_APPLETALK = 16;</code>
 +
| AppleTalk
 +
|-
 +
| <code>AF_NETBIOS = 17;</code>
 +
| NetBios-style addresses
 +
|-
 +
| <code>AF_VOICEVIEW = 18;</code>
 +
| VoiceView
 +
|-
 +
| <code>AF_FIREFOX = 19;</code>
 +
| FireFox
 +
|-
 +
| <code>AF_UNKNOWN1 = 20;</code>
 +
| Somebody is using this!
 +
|-
 +
| <code>AF_BAN = 21;</code>
 +
| Banyan
 +
|-
 +
| <code>AF_ATM = 22;</code>
 +
| Native ATM Services
 +
|-
 +
| <code>AF_INET6 = 23;</code>
 +
| Internetwork Version 6
 +
|-
 +
| <code>AF_CLUSTER = 24;</code>
 +
| Microsoft Wolfpack
 +
|-
 +
| <code>AF_12844 = 25;</code>
 +
| IEEE 1284.4 WG AF
 +
|-
 +
| <code>AF_IRDA = 26;</code>
 +
| IrDA
 +
|-
 +
| <code>AF_NETDES = 28;</code>
 +
| Network Designers OSI & gateway enabled
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>AF_MAX = 29;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Protocol family constants''' <code> PF_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>PF_UNSPEC = AF_UNSPEC;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>PF_UNIX = AF_UNIX;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_INET = AF_INET;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_IMPLINK = AF_IMPLINK;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_PUP = AF_PUP;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_CHAOS = AF_CHAOS;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_NS = AF_NS;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_IPX = AF_IPX;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_OSI = AF_OSI;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_ECMA = AF_ECMA;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_DATAKIT = AF_DATAKIT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_CCITT = AF_CCITT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_SNA = AF_SNA;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_DECnet = AF_DECnet;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_DLI = AF_DLI;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_LAT = AF_LAT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_HYLINK = AF_HYLINK;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_APPLETALK = AF_APPLETALK;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_VOICEVIEW = AF_VOICEVIEW;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_FIREFOX = AF_FIREFOX;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_UNKNOWN1 = AF_UNKNOWN1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_BAN = AF_BAN;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_ATM = AF_ATM;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_INET6 = AF_INET6;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_CLUSTER = AF_CLUSTER;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_12844 = AF_12844;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_IRDA = AF_IRDA;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PF_NETDES = AF_NETDES;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>PF_MAX = AF_MAX;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Message flag constants''' <code> MSG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MSG_OOB = $1;</code>
 +
| process out-of-band data
 +
|-
 +
| <code>MSG_PEEK = $2;</code>
 +
| peek at incoming message
 +
|-
 +
| <code>MSG_DONTROUTE = $4;</code>
 +
| send without using routing tables
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>MSG_INTERRUPT = $10;</code>
 +
| send/recv in the interrupt context
 +
|-
 +
| <code>MSG_MAXIOVLEN = 16;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>MSG_PARTIAL = $8000;</code>
 +
| partial send or recv for message xport
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Socket error constants''' <code> WSAE*, EAI_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|All Windows Sockets error constants are biased by WSABASEERR from the "normal"
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSABASEERR = 10000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Windows Sockets definitions of regular Microsoft C error constants''
 +
|-
 +
| <code>WSAEINTR = (WSABASEERR+4);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEBADF = (WSABASEERR+9);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEACCES = (WSABASEERR+13);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEFAULT = (WSABASEERR+14);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEINVAL = (WSABASEERR+22);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEMFILE = (WSABASEERR+24);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Windows Sockets definitions of regular Berkeley error constants''
 +
|-
 +
| <code>WSAEWOULDBLOCK = (WSABASEERR+35);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEINPROGRESS = (WSABASEERR+36);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEALREADY = (WSABASEERR+37);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENOTSOCK = (WSABASEERR+38);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEDESTADDRREQ = (WSABASEERR+39);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEMSGSIZE = (WSABASEERR+40);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEPROTOTYPE = (WSABASEERR+41);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENOPROTOOPT = (WSABASEERR+42);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEPROTONOSUPPORT = (WSABASEERR+43);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAESOCKTNOSUPPORT = (WSABASEERR+44);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEOPNOTSUPP = (WSABASEERR+45);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEPFNOSUPPORT = (WSABASEERR+46);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEAFNOSUPPORT = (WSABASEERR+47);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEADDRINUSE = (WSABASEERR+48);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEADDRNOTAVAIL = (WSABASEERR+49);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENETDOWN = (WSABASEERR+50);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENETUNREACH = (WSABASEERR+51);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENETRESET = (WSABASEERR+52);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAECONNABORTED = (WSABASEERR+53);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAECONNRESET = (WSABASEERR+54);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENOBUFS = (WSABASEERR+55);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEISCONN = (WSABASEERR+56);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENOTCONN = (WSABASEERR+57);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAESHUTDOWN = (WSABASEERR+58);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAETOOMANYREFS = (WSABASEERR+59);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAETIMEDOUT = (WSABASEERR+60);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAECONNREFUSED = (WSABASEERR+61);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAELOOP = (WSABASEERR+62);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENAMETOOLONG = (WSABASEERR+63);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEHOSTDOWN = (WSABASEERR+64);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEHOSTUNREACH = (WSABASEERR+65);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAENOTEMPTY = (WSABASEERR+66);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEPROCLIM = (WSABASEERR+67);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEUSERS = (WSABASEERR+68);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEDQUOT = (WSABASEERR+69);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAESTALE = (WSABASEERR+70);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEREMOTE = (WSABASEERR+71);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSAEDISCON = (WSABASEERR+101);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Extended Windows Sockets error constant definitions''
 +
|-
 +
| <code>WSASYSNOTREADY = (WSABASEERR+91);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAVERNOTSUPPORTED = (WSABASEERR+92);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSANOTINITIALISED = (WSABASEERR+93);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSAENOMORE = (WSABASEERR+102);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAECANCELLED = (WSABASEERR+103);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEINVALIDPROCTABLE = (WSABASEERR+104);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEINVALIDPROVIDER = (WSABASEERR+105);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEPROVIDERFAILEDINIT = (WSABASEERR+106);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSASYSCALLFAILURE = (WSABASEERR+107);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSASERVICE_NOT_FOUND = (WSABASEERR+108);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSATYPE_NOT_FOUND = (WSABASEERR+109);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_E_NO_MORE = (WSABASEERR+110);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_E_CANCELLED = (WSABASEERR+111);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSAEREFUSED = (WSABASEERR+112);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp; 
 +
|-
 +
|colspan="2"|Error return codes from gethostbyname() and gethostbyaddr() (when using the resolver). Note that these errors are retrieved via WSAGetLastError() and must therefore follow the rules for avoiding clashes with error numbers from specific implementations or language run-time systems. For this reason the codes are based at WSABASEERR+1001. Note also that [WSA]NO_ADDRESS is defined only for compatibility purposes.
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Authoritative Answer: Host not found''
 +
|-
 +
| <code>WSAHOST_NOT_FOUND = (WSABASEERR+1001);</code>
 +
| &nbsp;
 +
|-
 +
| <code>HOST_NOT_FOUND = WSAHOST_NOT_FOUND;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Non-Authoritative: Host not found, or SERVERFAIL''
 +
|-
 +
| <code>WSATRY_AGAIN = (WSABASEERR+1002);</code>
 +
| &nbsp;
 +
|-
 +
| <code>TRY_AGAIN = WSATRY_AGAIN;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Non recoverable errors, FORMERR, REFUSED, NOTIMP''
 +
|-
 +
| <code>WSANO_RECOVERY = (WSABASEERR+1003)</code>
 +
| &nbsp;
 +
|-
 +
| <code>NO_RECOVERY = WSANO_RECOVERY;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Valid name, no data record of requested type''
 +
|-
 +
| <code>WSANO_DATA = (WSABASEERR+1004);</code>
 +
| &nbsp;
 +
|-
 +
| <code>NO_DATA = WSANO_DATA;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''no address, look for MX record''
 +
|-
 +
| <code>WSANO_ADDRESS = WSANO_DATA;</code>
 +
| &nbsp;
 +
|-
 +
| <code>NO_ADDRESS = WSANO_ADDRESS;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''WinSock 2 extension -- new error codes and type definition''
 +
|-
 +
| <code>WSA_IO_PENDING = ERROR_IO_PENDING;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_IO_INCOMPLETE = ERROR_IO_INCOMPLETE;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_INVALID_HANDLE = ERROR_INVALID_HANDLE;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_INVALID_PARAMETER = ERROR_INVALID_PARAMETER;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_NOT_ENOUGH_MEMORY = ERROR_NOT_ENOUGH_MEMORY;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_OPERATION_ABORTED = ERROR_OPERATION_ABORTED;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_INVALID_EVENT = WSAEVENT(nil);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_MAXIMUM_WAIT_EVENTS = MAXIMUM_WAIT_OBJECTS;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_WAIT_FAILED = $ffffffff;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_WAIT_EVENT_0 = WAIT_OBJECT_0;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_WAIT_IO_COMPLETION = WAIT_IO_COMPLETION;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_WAIT_TIMEOUT = WAIT_TIMEOUT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_INFINITE = INFINITE;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Windows Sockets errors redefined as regular Berkeley error constants. These are commented out in Windows NT to avoid conflicts with errno.h. Use the WSA constants instead.''
 +
|-
 +
| <code>EWOULDBLOCK = WSAEWOULDBLOCK;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EINPROGRESS = WSAEINPROGRESS;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EALREADY = WSAEALREADY;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENOTSOCK = WSAENOTSOCK;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EDESTADDRREQ = WSAEDESTADDRREQ;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EMSGSIZE = WSAEMSGSIZE;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EPROTOTYPE = WSAEPROTOTYPE;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENOPROTOOPT = WSAENOPROTOOPT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EPROTONOSUPPORT = WSAEPROTONOSUPPORT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EOPNOTSUPP = WSAEOPNOTSUPP;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EPFNOSUPPORT = WSAEPFNOSUPPORT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAFNOSUPPORT = WSAEAFNOSUPPORT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EADDRINUSE = WSAEADDRINUSE;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EADDRNOTAVAIL = WSAEADDRNOTAVAIL;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENETDOWN = WSAENETDOWN;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENETUNREACH = WSAENETUNREACH;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENETRESET = WSAENETRESET;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ECONNABORTED = WSAECONNABORTED;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ECONNRESET = WSAECONNRESET;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENOBUFS = WSAENOBUFS;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EISCONN = WSAEISCONN;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENOTCONN = WSAENOTCONN;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ESHUTDOWN = WSAESHUTDOWN;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ETOOMANYREFS = WSAETOOMANYREFS;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ETIMEDOUT = WSAETIMEDOUT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ECONNREFUSED = WSAECONNREFUSED;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ELOOP = WSAELOOP;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENAMETOOLONG = WSAENAMETOOLONG;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EHOSTDOWN = WSAEHOSTDOWN;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EHOSTUNREACH = WSAEHOSTUNREACH;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENOTEMPTY = WSAENOTEMPTY;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EPROCLIM = WSAEPROCLIM;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EUSERS = WSAEUSERS;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EDQUOT = WSAEDQUOT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ESTALE = WSAESTALE;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EREMOTE = WSAEREMOTE;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ENOTREADY = WSASYSNOTREADY;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EVERNOTSUPPORTED = WSAVERNOTSUPPORTED;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ENOTINITIALISED = WSANOTINITIALISED;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Error codes from getaddrinfo()''
 +
|-
 +
| <code>EAI_AGAIN = WSATRY_AGAIN;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_BADFLAGS = WSAEINVAL;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_FAIL = WSANO_RECOVERY;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_FAMILY = WSAEAFNOSUPPORT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_MEMORY = WSA_NOT_ENOUGH_MEMORY;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_NODATA = WSANO_DATA;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_NONAME = WSAHOST_NOT_FOUND;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_SERVICE = WSATYPE_NOT_FOUND;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EAI_SOCKTYPE = WSAESOCKTNOSUPPORT;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>EAI_NODATA = EAI_NONAME;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Shutdown options''' <code> SD_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SD_RECEIVE = $00;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>SD_SEND = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SD_BOTH = $02;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''WsControlEx option constants''' <code> WSA_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Global Socket constants for undocumented Winsock functions
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_MAX_INTERFACE_NAME_LEN = 256;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>WSA_ANY_SIZE = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_MAX_ADAPTER_NAME = 128;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_MAX_ADAPTER_DESCRIPTION_LENGTH = 128;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_MAX_ADAPTER_NAME_LENGTH = 256;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_MAX_ADAPTER_ADDRESS_LENGTH = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_MAX_HOSTNAME_LEN = 128;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_MAX_DOMAIN_NAME_LEN = 128;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_MAX_SCOPE_ID_LEN = 256;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_MAXLEN_IFDESCR = 256;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_MAXLEN_PHYSADDR = 8;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_USE_CURRENT_TTL = DWORD(-1);</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_USE_CURRENT_FORWARDING = DWORD(-1);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_IP_FORWARDING = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_IP_NOT_FORWARDING = 2;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_GETNUMBEROFINTERFACES = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETIFENTRY = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETIFTABLE = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETIPADDRTABLE = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETIPNETTABLE = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETIPFORWARDTABLE = 6;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETTCPTABLE = 7;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETUDPTABLE = 8;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_GETIPSTATISTICS = 9;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETICMPSTATISTICS = 10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETTCPSTATISTICS = 11;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETUDPSTATISTICS = 12;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_SETIFENTRY = 13;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_CREATEIPFORWARDENTRY = 14;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_SETIPFORWARDENTRY = 15;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_DELETEIPFORWARDENTRY = 16;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_SETIPSTATISTICS = 17;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_SETIPTTL = 18;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_CREATEIPNETENTRY = 19;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_SETIPNETENTRY = 20;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_DELETEIPNETENTRY = 21;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_FLUSHIPNETTABLE = 22;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_CREATEPROXYARPENTRY = 23;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_DELETEPROXTARPENTRY = 24;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_SETTCPENTRY = 25;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETINTERFACEINFO = 26;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETUNIDIRECTIONALADAPTERINFO = 27;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WSA_GETBESTINTERFACE = 28;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETBESTROUTE = 29;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_NOTIFYADDRCHANGE = 30;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_NOTIFYROUTECHANGE = 31;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETADAPTERINDEX = 32;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_ADDIPADDRESS = 33;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_DELETEIPADDRESS = 34;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETNETWORKPARAMS = 35;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETADAPTERSINFO = 36;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETPERADAPTERINFO = 37;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_IPRELEASEADDRESS = 38;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_IPRENEWADDRESS = 39;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_SENDARP = 40;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETRTTANDHOPCOUNT = 41;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_GETFRIENDLYIFINDEX = 42;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_ENABLEROUTER = 43;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WSA_UNENABLEROUTER = 44;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Address info flag constants''' <code> AI_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Flags used in "hints" argument to getaddrinfo()
 +
|-
 +
|colspan="2"|Note: Under Linux these values may be different
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>AI_PASSIVE = $00000001;</code>
 +
| Socket address will be used in bind() call
 +
|-
 +
| <code>AI_CANONNAME = $00000002;</code>
 +
| Return canonical name from DNS in the first ai_canonname (Cannot be used with AI_FQDN)
 +
|-
 +
| <code>AI_NUMERICHOST = $00000004;</code>
 +
| Nodename must be a numeric address string
 +
|-
 +
| <code>AI_NUMERICSERV = $00000008;</code>
 +
| Servicename must be a numeric port string
 +
|-
 +
| <code>AI_ALL = $00000100;</code>
 +
| Return both IPv6 and IPv4 addresses
 +
|-
 +
| <code>AI_ADDRCONFIG = $00000400;</code>
 +
| Only return addresses if a global address is configured (IPv4 or IPv6), loopback addresses do not count as global.
 +
|-
 +
| <code>AI_V4MAPPED = $00000800;</code>
 +
| Map returned IPv4 addresses to IPv6 address format
 +
|-
 +
| <code>AI_NON_AUTHORITATIVE = $00004000;</code>
 +
| Allow both autoritive and non authoritive return addresses (NS_EMAIL only)
 +
|-
 +
| <code>AI_SECURE = $00008000;</code>
 +
| Obtain result using enhanced security only (NS_EMAIL only)
 +
|-
 +
| <code>AI_RETURN_PREFERRED_NAMES = $00010000;</code>
 +
| Return preferred names (NS_EMAIL only)
 +
|-
 +
| <code>AI_FQDN = $00020000;</code>
 +
| Return the FQDN for the single name specified on NodeName (Cannot be used with AI_CANONNAME)
 +
|-
 +
| <code>AI_FILESERVER = $00040000;</code>
 +
| The requested name is being used for file sharing (Hint Only)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Name info flag constants''' <code> NI_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Flags for getnameinfo()
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>NI_NOFQDN = $01;</code>
 +
| Only return nodename portion for local hosts
 +
|-
 +
| <code>NI_NUMERICHOST = $02;</code>
 +
| Return numeric form of the host's address
 +
|-
 +
| <code>NI_NAMEREQD = $04;</code>
 +
| Error if the host's name not in DNS
 +
|-
 +
| <code>NI_NUMERICSERV = $08;</code>
 +
| Return numeric form of the service (port #)
 +
|-
 +
| <code>NI_DGRAM = $10;</code>
 +
| Service is a datagram service
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>NI_MAXHOST = 1025;</code>
 +
| Max size of a fully-qualified domain name
 +
|-
 +
| <code>NI_MAXSERV = 32;</code>
 +
| Max size of a service name
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===

Revision as of 06:03, 23 December 2016

Return to Unit Reference


Description


Ultibo Global Socket Definitions

To be documented

Constants



Global socket constants FD_*
FD_SETSIZE = 64;  
 
IOCPARM_MASK = $7f;  
IOC_VOID = $20000000;  
IOC_OUT = $40000000;  
IOC_IN = $80000000;  
IOC_INOUT = (IOC_IN or IOC_OUT);  
 
FIONREAD = Cardinal( IOC_OUT or get # bytes to read
((4 and IOCPARM_MASK) shl 16) or (102 shl 8) or 127);  
FIONBIO = Cardinal(IOC_IN or set/clear non-blocking i/o
((4 and IOCPARM_MASK) shl 16) or (102 shl 8) or 126);  
FIOASYNC = Cardinal(IOC_IN or set/clear async i/o
((4 and IOCPARM_MASK) shl 16) or (102 shl 8) or 125);  
 
SIOCSHIWAT = Cardinal( IOC_IN or set high watermark
((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 0);  
SIOCGHIWAT = Cardinal( IOC_OUT or get high watermark
((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 1);  
SIOCSLOWAT = Cardinal( IOC_IN or set low watermark
((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 2);  
SIOCGLOWAT = Cardinal( IOC_OUT or get low watermark
((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 3);  
SIOCATMARK = Cardinal( IOC_OUT or at oob mark
((4 and IOCPARM_MASK) shl 16) or (115 shl 8) or 7);  
 
IMPLINK_IP = 155;  
IMPLINK_LOWEXPER = 156;  
IMPLINK_HIGHEXPER = 158;  
 
TF_DISCONNECT = $01;  
TF_REUSE_SOCKET = $02;  
TF_WRITE_BEHIND = $04;  
 
INVALID_SOCKET = TSocket(NOT(0)); This is used instead of -1, since the TSocket type is unsigned.
SOCKET_ERROR = -1;  
 
Level number for (get/set)sockopt() to apply to socket itself
SOL_SOCKET = $ffff; options for socket level
 
Maximum queue length specifiable by listen
SOMAXCONN = 5;  
 
Define constant based on rfc883, used by gethostbyxxxx() calls
MAXGETHOSTSTRUCT = 1024;  
 
Define flags to be used with the WSAAsyncSelect() call
FD_READ = $01;  
FD_WRITE = $02;  
FD_OOB = $04;  
FD_ACCEPT = $08;  
FD_CONNECT = $10;  
FD_CLOSE = $20;  
 
WSADESCRIPTION_LEN = 256;  
WSASYS_STATUS_LEN = 128;  
 
Global Socket constants for enhanced Winsock functions
MAX_NAME_SIZE = 80;  
MAX_NAME_ALIASES = 5;  
MAX_NAME_SERVERS = 5;  
MAX_HOST_ALIASES = 16;  
 
INET_ADDRSTR_ANY = '0.0.0.0';  
INET6_ADDRSTR_INIT = '0::0';  
 
INET_ADDRSTR_BROADCAST = '255.255.255.255';  
 
INET_ADDRSTRLEN = 16; Max size of numeric form of IPv4 address
INET6_ADDRSTRLEN = 46; Max size of numeric form of IPv6 address


IP protocol constants IPPROTO_*
IPPROTO_IP = 0; dummy for IP
IPPROTO_ICMP = 1; control message protocol
IPPROTO_IGMP = 2; group management protocol
IPPROTO_GGP = 3; gateway^2 (deprecated)
IPPROTO_TCP = 6; tcp
IPPROTO_EGP = 8; egp
IPPROTO_PUP =12; pup
IPPROTO_UDP =17; user datagram protocol
IPPROTO_HMP =20; hmp
IPPROTO_IDP =22; xns idp
IPPROTO_RDP =27; rdp
IPPROTO_IPV6 = 41; IP6 header
IPPROTO_ROUTING = 43; IP6 routing header
IPPROTO_FRAGMENT = 44; IP6 fragmentation header
IPPROTO_ICMPV6 = 58; ICMP6
IPPROTO_RVD = 66; rvd
IPPROTO_ND = 77; UNOFFICIAL net disk proto
IPPROTO_RAW = 255; raw IP packet
IPPROTO_MAX = 256;  
 
NSPROTO_IPX = 1000; ipx protocol
NSPROTO_SPX = 1256; spx protocol
NSPROTO_SPXII = 1257; spxii protocol


IP port constants IPPORT_*
Port/socket numbers: network standard functions
IPPORT_ANY = 0;  
IPPORT_ECHO = 7;  
IPPORT_DISCARD = 9;  
IPPORT_SYSTAT = 11;  
IPPORT_DAYTIME = 13;  
IPPORT_NETSTAT = 15;  
IPPORT_FTP = 21;  
IPPORT_TELNET = 23;  
IPPORT_SMTP = 5;  
IPPORT_TIMESERVER = 37;  
IPPORT_NAMESERVER = 42;  
IPPORT_WHOIS = 43;  
IPPORT_DNS = 53;  
IPPORT_MTP = 57;  
IPPORT_BOOTPS = 67;  
IPPORT_BOOTPC = 68;  
 
Port/socket numbers: host specific functions
IPPORT_TFTP = 69;  
IPPORT_RJE = 77;  
IPPORT_FINGER = 79;  
IPPORT_TTYLINK = 87;  
IPPORT_SUPDUP = 95;  
 
UNIX TCP sockets
IPPORT_EXECSERVER = 512;  
IPPORT_LOGINSERVER = 513;  
IPPORT_CMDSERVER = 514;  
IPPORT_EFSSERVER = 520;  
 
UNIX UDP sockets
IPPORT_BIFFUDP = 512;  
IPPORT_WHOSERVER = 513;  
IPPORT_ROUTESERVER = 520;  
 
Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root)
IPPORT_RESERVED = 1024;  


IP options constants IP_*
Options for use with [gs]etsockopt at the IP level
 
IP_OPTIONS = 1;  
IP_MULTICAST_IF = 2; set/get IP multicast interface
IP_MULTICAST_TTL = 3; set/get IP multicast timetolive
IP_MULTICAST_LOOP = 4; set/get IP multicast loopback
IP_ADD_MEMBERSHIP = 5; add an IP group membership
IP_DROP_MEMBERSHIP = 6; drop an IP group membership
IP_TTL = 7; set/get IP Time To Live
IP_TOS = 8; set/get IP Type Of Service
IP_DONTFRAGMENT = 9; set/get IP Don't Fragment flag
IP_HDRINCL = 10; set/get IP Header include
 
IP_DEFAULT_MULTICAST_TTL = 1; normally limit m'casts to 1 hop
IP_DEFAULT_MULTICAST_LOOP = 1; normally hear sends if a member
IP_MAX_MEMBERSHIPS = 20; per socket; must fit in one mbuf


Socket type constants SOCK_*
SOCK_UNSPEC = 0; unspecified
SOCK_STREAM = 1; stream socket
SOCK_DGRAM = 2; datagram socket
SOCK_RAW = 3; raw-protocol interface
SOCK_RDM = 4; reliably-delivered message
SOCK_SEQPACKET = 5; sequenced packet stream
SOCK_PACKET = 10; linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level.


Socket option constants SO_*
Option flags per-socket
 
SO_DEBUG = $0001; turn on debugging info recording
SO_ACCEPTCONN = $0002; socket has had listen()
SO_REUSEADDR = $0004; allow local address reuse
SO_KEEPALIVE = $0008; keep connections alive
SO_DONTROUTE = $0010; just use interface addresses
SO_BROADCAST = $0020; permit sending of broadcast msgs
SO_USELOOPBACK = $0040; bypass hardware when possible
SO_LINGER = $0080; linger on close if data present
SO_OOBINLINE = $0100; leave received OOB data in line
 
SO_DONTLINGER = $ff7f;  
 
Additional options
SO_SNDBUF = $1001; send buffer size
SO_RCVBUF = $1002; receive buffer size
SO_SNDLOWAT = $1003; send low-water mark
SO_RCVLOWAT = $1004; receive low-water mark
SO_SNDTIMEO = $1005; send timeout
SO_RCVTIMEO = $1006; receive timeout
SO_ERROR = $1007; get error status and clear
SO_TYPE = $1008; get socket type
SO_CONNTIMEO = $1009; connection timeout
 
Options for connect and disconnect data and options. Used only by non-TCP/IP transports such as DECNet, OSI TP4, etc'.'
SO_CONNDATA = $7000;  
SO_CONNOPT = $7001;  
SO_DISCDATA = $7002;  
SO_DISCOPT = $7003;  
SO_CONNDATALEN = $7004;  
SO_CONNOPTLEN = $7005;  
SO_DISCDATALEN = $7006;  
SO_DISCOPTLEN = $7007;  
 
Option for opening sockets for synchronous access
SO_OPENTYPE = $7008;  
SO_SYNCHRONOUS_ALERT = $10;  
SO_SYNCHRONOUS_NONALERT = $20;  
 
Other NT-specific options
SO_MAXDG = $7009;  
SO_MAXPATHDG = $700A;  
SO_UPDATE_ACCEPT_CONTEXT = $700B;  
SO_CONNECT_TIME = $700C;  


TCP option constants TCP_*
TCP_NODELAY = $0001;  
TCP_MAXSEG = $0002;  
TCP_NOPUSH = $0004;  
TCP_NOOPT = $0008;  
TCP_BSDURGENT = $7000; Implement BSD Urgent instead of RFC793/1122
 
TCP_WSCALE = $0010;  
TCP_NOSACK = $0020;  


UDP option constants UDP_*
UDP_NOCHECKSUM = $0001;  


Address family constants AF_*
AF_UNSPEC = 0; unspecified
AF_UNIX = 1; local to host (pipes, portals)
AF_INET = 2; internetwork: UDP, TCP, etc.
AF_IMPLINK = 3; arpanet imp addresses
AF_PUP = 4; pup protocols: e.g. BSP
AF_CHAOS = 5; mit CHAOS protocols
AF_IPX = 6; IPX and SPX
AF_NS = 6; XEROX NS protocols
AF_ISO = 7; ISO protocols
AF_OSI = AF_ISO; OSI is ISO
AF_ECMA = 8; european computer manufacturers
AF_DATAKIT = 9; datakit protocols
AF_CCITT = 10; CCITT protocols, X.25 etc
AF_SNA = 11; IBM SNA
AF_DECnet = 12; DECnet
AF_DLI = 13; Direct data link interface
AF_LAT = 14; LAT
AF_HYLINK = 15; NSC Hyperchannel
AF_APPLETALK = 16; AppleTalk
AF_NETBIOS = 17; NetBios-style addresses
AF_VOICEVIEW = 18; VoiceView
AF_FIREFOX = 19; FireFox
AF_UNKNOWN1 = 20; Somebody is using this!
AF_BAN = 21; Banyan
AF_ATM = 22; Native ATM Services
AF_INET6 = 23; Internetwork Version 6
AF_CLUSTER = 24; Microsoft Wolfpack
AF_12844 = 25; IEEE 1284.4 WG AF
AF_IRDA = 26; IrDA
AF_NETDES = 28; Network Designers OSI & gateway enabled
 
AF_MAX = 29;  


Protocol family constants PF_*
PF_UNSPEC = AF_UNSPEC;  
PF_UNIX = AF_UNIX;  
PF_INET = AF_INET;  
PF_IMPLINK = AF_IMPLINK;  
PF_PUP = AF_PUP;  
PF_CHAOS = AF_CHAOS;  
PF_NS = AF_NS;  
PF_IPX = AF_IPX;  
PF_OSI = AF_OSI;  
PF_ECMA = AF_ECMA;  
PF_DATAKIT = AF_DATAKIT;  
PF_CCITT = AF_CCITT;  
PF_SNA = AF_SNA;  
PF_DECnet = AF_DECnet;  
PF_DLI = AF_DLI;  
PF_LAT = AF_LAT;  
PF_HYLINK = AF_HYLINK;  
PF_APPLETALK = AF_APPLETALK;  
PF_VOICEVIEW = AF_VOICEVIEW;  
PF_FIREFOX = AF_FIREFOX;  
PF_UNKNOWN1 = AF_UNKNOWN1;  
PF_BAN = AF_BAN;  
PF_ATM = AF_ATM;  
PF_INET6 = AF_INET6;  
PF_CLUSTER = AF_CLUSTER;  
PF_12844 = AF_12844;  
PF_IRDA = AF_IRDA;  
PF_NETDES = AF_NETDES;  
 
PF_MAX = AF_MAX;  


Message flag constants MSG_*
MSG_OOB = $1; process out-of-band data
MSG_PEEK = $2; peek at incoming message
MSG_DONTROUTE = $4; send without using routing tables
 
MSG_INTERRUPT = $10; send/recv in the interrupt context
MSG_MAXIOVLEN = 16;  
 
MSG_PARTIAL = $8000; partial send or recv for message xport


Socket error constants WSAE*, EAI_*
All Windows Sockets error constants are biased by WSABASEERR from the "normal"
 
WSABASEERR = 10000;  
 
Windows Sockets definitions of regular Microsoft C error constants
WSAEINTR = (WSABASEERR+4);  
WSAEBADF = (WSABASEERR+9);  
WSAEACCES = (WSABASEERR+13);  
WSAEFAULT = (WSABASEERR+14);  
WSAEINVAL = (WSABASEERR+22);  
WSAEMFILE = (WSABASEERR+24);  
 
Windows Sockets definitions of regular Berkeley error constants
WSAEWOULDBLOCK = (WSABASEERR+35);  
WSAEINPROGRESS = (WSABASEERR+36);  
WSAEALREADY = (WSABASEERR+37);  
WSAENOTSOCK = (WSABASEERR+38);  
WSAEDESTADDRREQ = (WSABASEERR+39);  
WSAEMSGSIZE = (WSABASEERR+40);  
WSAEPROTOTYPE = (WSABASEERR+41);  
WSAENOPROTOOPT = (WSABASEERR+42);  
WSAEPROTONOSUPPORT = (WSABASEERR+43);  
WSAESOCKTNOSUPPORT = (WSABASEERR+44);  
WSAEOPNOTSUPP = (WSABASEERR+45);  
WSAEPFNOSUPPORT = (WSABASEERR+46);  
WSAEAFNOSUPPORT = (WSABASEERR+47);  
WSAEADDRINUSE = (WSABASEERR+48);  
WSAEADDRNOTAVAIL = (WSABASEERR+49);  
WSAENETDOWN = (WSABASEERR+50);  
WSAENETUNREACH = (WSABASEERR+51);  
WSAENETRESET = (WSABASEERR+52);  
WSAECONNABORTED = (WSABASEERR+53);  
WSAECONNRESET = (WSABASEERR+54);  
WSAENOBUFS = (WSABASEERR+55);  
WSAEISCONN = (WSABASEERR+56);  
WSAENOTCONN = (WSABASEERR+57);  
WSAESHUTDOWN = (WSABASEERR+58);  
WSAETOOMANYREFS = (WSABASEERR+59);  
WSAETIMEDOUT = (WSABASEERR+60);  
WSAECONNREFUSED = (WSABASEERR+61);  
WSAELOOP = (WSABASEERR+62);  
WSAENAMETOOLONG = (WSABASEERR+63);  
WSAEHOSTDOWN = (WSABASEERR+64);  
WSAEHOSTUNREACH = (WSABASEERR+65);  
WSAENOTEMPTY = (WSABASEERR+66);  
WSAEPROCLIM = (WSABASEERR+67);  
WSAEUSERS = (WSABASEERR+68);  
WSAEDQUOT = (WSABASEERR+69);  
WSAESTALE = (WSABASEERR+70);  
WSAEREMOTE = (WSABASEERR+71);  
 
WSAEDISCON = (WSABASEERR+101);  
 
Extended Windows Sockets error constant definitions
WSASYSNOTREADY = (WSABASEERR+91);  
WSAVERNOTSUPPORTED = (WSABASEERR+92);  
WSANOTINITIALISED = (WSABASEERR+93);  
 
WSAENOMORE = (WSABASEERR+102);  
WSAECANCELLED = (WSABASEERR+103);  
WSAEINVALIDPROCTABLE = (WSABASEERR+104);  
WSAEINVALIDPROVIDER = (WSABASEERR+105);  
WSAEPROVIDERFAILEDINIT = (WSABASEERR+106);  
WSASYSCALLFAILURE = (WSABASEERR+107);  
WSASERVICE_NOT_FOUND = (WSABASEERR+108);  
WSATYPE_NOT_FOUND = (WSABASEERR+109);  
WSA_E_NO_MORE = (WSABASEERR+110);  
WSA_E_CANCELLED = (WSABASEERR+111);  
WSAEREFUSED = (WSABASEERR+112);  
 
Error return codes from gethostbyname() and gethostbyaddr() (when using the resolver). Note that these errors are retrieved via WSAGetLastError() and must therefore follow the rules for avoiding clashes with error numbers from specific implementations or language run-time systems. For this reason the codes are based at WSABASEERR+1001. Note also that [WSA]NO_ADDRESS is defined only for compatibility purposes.
 
Authoritative Answer: Host not found
WSAHOST_NOT_FOUND = (WSABASEERR+1001);  
HOST_NOT_FOUND = WSAHOST_NOT_FOUND;  
 
Non-Authoritative: Host not found, or SERVERFAIL
WSATRY_AGAIN = (WSABASEERR+1002);  
TRY_AGAIN = WSATRY_AGAIN;  
 
Non recoverable errors, FORMERR, REFUSED, NOTIMP
WSANO_RECOVERY = (WSABASEERR+1003)  
NO_RECOVERY = WSANO_RECOVERY;  
 
Valid name, no data record of requested type
WSANO_DATA = (WSABASEERR+1004);  
NO_DATA = WSANO_DATA;  
 
no address, look for MX record
WSANO_ADDRESS = WSANO_DATA;  
NO_ADDRESS = WSANO_ADDRESS;  
 
WinSock 2 extension -- new error codes and type definition
WSA_IO_PENDING = ERROR_IO_PENDING;  
WSA_IO_INCOMPLETE = ERROR_IO_INCOMPLETE;  
WSA_INVALID_HANDLE = ERROR_INVALID_HANDLE;  
WSA_INVALID_PARAMETER = ERROR_INVALID_PARAMETER;  
WSA_NOT_ENOUGH_MEMORY = ERROR_NOT_ENOUGH_MEMORY;  
WSA_OPERATION_ABORTED = ERROR_OPERATION_ABORTED;  
WSA_INVALID_EVENT = WSAEVENT(nil);  
WSA_MAXIMUM_WAIT_EVENTS = MAXIMUM_WAIT_OBJECTS;  
WSA_WAIT_FAILED = $ffffffff;  
WSA_WAIT_EVENT_0 = WAIT_OBJECT_0;  
WSA_WAIT_IO_COMPLETION = WAIT_IO_COMPLETION;  
WSA_WAIT_TIMEOUT = WAIT_TIMEOUT;  
WSA_INFINITE = INFINITE;  
 
Windows Sockets errors redefined as regular Berkeley error constants. These are commented out in Windows NT to avoid conflicts with errno.h. Use the WSA constants instead.
EWOULDBLOCK = WSAEWOULDBLOCK;  
EINPROGRESS = WSAEINPROGRESS;  
EALREADY = WSAEALREADY;  
ENOTSOCK = WSAENOTSOCK;  
EDESTADDRREQ = WSAEDESTADDRREQ;  
EMSGSIZE = WSAEMSGSIZE;  
EPROTOTYPE = WSAEPROTOTYPE;  
ENOPROTOOPT = WSAENOPROTOOPT;  
EPROTONOSUPPORT = WSAEPROTONOSUPPORT;  
ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT;  
EOPNOTSUPP = WSAEOPNOTSUPP;  
EPFNOSUPPORT = WSAEPFNOSUPPORT;  
EAFNOSUPPORT = WSAEAFNOSUPPORT;  
EADDRINUSE = WSAEADDRINUSE;  
EADDRNOTAVAIL = WSAEADDRNOTAVAIL;  
ENETDOWN = WSAENETDOWN;  
ENETUNREACH = WSAENETUNREACH;  
ENETRESET = WSAENETRESET;  
ECONNABORTED = WSAECONNABORTED;  
ECONNRESET = WSAECONNRESET;  
ENOBUFS = WSAENOBUFS;  
EISCONN = WSAEISCONN;  
ENOTCONN = WSAENOTCONN;  
ESHUTDOWN = WSAESHUTDOWN;  
ETOOMANYREFS = WSAETOOMANYREFS;  
ETIMEDOUT = WSAETIMEDOUT;  
ECONNREFUSED = WSAECONNREFUSED;  
ELOOP = WSAELOOP;  
ENAMETOOLONG = WSAENAMETOOLONG;  
EHOSTDOWN = WSAEHOSTDOWN;  
EHOSTUNREACH = WSAEHOSTUNREACH;  
ENOTEMPTY = WSAENOTEMPTY;  
EPROCLIM = WSAEPROCLIM;  
EUSERS = WSAEUSERS;  
EDQUOT = WSAEDQUOT;  
ESTALE = WSAESTALE;  
EREMOTE = WSAEREMOTE;  
 
ENOTREADY = WSASYSNOTREADY;  
EVERNOTSUPPORTED = WSAVERNOTSUPPORTED;  
ENOTINITIALISED = WSANOTINITIALISED;  
 
Error codes from getaddrinfo()
EAI_AGAIN = WSATRY_AGAIN;  
EAI_BADFLAGS = WSAEINVAL;  
EAI_FAIL = WSANO_RECOVERY;  
EAI_FAMILY = WSAEAFNOSUPPORT;  
EAI_MEMORY = WSA_NOT_ENOUGH_MEMORY;  
EAI_NODATA = WSANO_DATA;  
EAI_NONAME = WSAHOST_NOT_FOUND;  
EAI_SERVICE = WSATYPE_NOT_FOUND;  
EAI_SOCKTYPE = WSAESOCKTNOSUPPORT;  
 
EAI_NODATA = EAI_NONAME;  


Shutdown options SD_*
SD_RECEIVE = $00;  
SD_SEND = $01;  
SD_BOTH = $02;  


WsControlEx option constants WSA_*
Global Socket constants for undocumented Winsock functions
 
WSA_MAX_INTERFACE_NAME_LEN = 256;  
WSA_ANY_SIZE = 1;  
 
WSA_MAX_ADAPTER_NAME = 128;  
 
WSA_MAX_ADAPTER_DESCRIPTION_LENGTH = 128;  
WSA_MAX_ADAPTER_NAME_LENGTH = 256;  
WSA_MAX_ADAPTER_ADDRESS_LENGTH = 8;  
WSA_MAX_HOSTNAME_LEN = 128;  
WSA_MAX_DOMAIN_NAME_LEN = 128;  
WSA_MAX_SCOPE_ID_LEN = 256;  
 
WSA_MAXLEN_IFDESCR = 256;  
WSA_MAXLEN_PHYSADDR = 8;  
 
WSA_USE_CURRENT_TTL = DWORD(-1);  
WSA_USE_CURRENT_FORWARDING = DWORD(-1);  
 
WSA_IP_FORWARDING = 1;  
WSA_IP_NOT_FORWARDING = 2;  
 
WSA_GETNUMBEROFINTERFACES = 1;  
WSA_GETIFENTRY = 2;  
WSA_GETIFTABLE = 3;  
WSA_GETIPADDRTABLE = 4;  
WSA_GETIPNETTABLE = 5;  
WSA_GETIPFORWARDTABLE = 6;  
WSA_GETTCPTABLE = 7;  
WSA_GETUDPTABLE = 8;  
 
WSA_GETIPSTATISTICS = 9;  
WSA_GETICMPSTATISTICS = 10;  
WSA_GETTCPSTATISTICS = 11;  
WSA_GETUDPSTATISTICS = 12;  
 
WSA_SETIFENTRY = 13;  
WSA_CREATEIPFORWARDENTRY = 14;  
WSA_SETIPFORWARDENTRY = 15;  
WSA_DELETEIPFORWARDENTRY = 16;  
 
WSA_SETIPSTATISTICS = 17;  
WSA_SETIPTTL = 18;  
 
WSA_CREATEIPNETENTRY = 19;  
WSA_SETIPNETENTRY = 20;  
WSA_DELETEIPNETENTRY = 21;  
WSA_FLUSHIPNETTABLE = 22;  
 
WSA_CREATEPROXYARPENTRY = 23;  
WSA_DELETEPROXTARPENTRY = 24;  
 
WSA_SETTCPENTRY = 25;  
WSA_GETINTERFACEINFO = 26;  
WSA_GETUNIDIRECTIONALADAPTERINFO = 27;  
 
WSA_GETBESTINTERFACE = 28;  
WSA_GETBESTROUTE = 29;  
WSA_NOTIFYADDRCHANGE = 30;  
WSA_NOTIFYROUTECHANGE = 31;  
WSA_GETADAPTERINDEX = 32;  
WSA_ADDIPADDRESS = 33;  
WSA_DELETEIPADDRESS = 34;  
WSA_GETNETWORKPARAMS = 35;  
WSA_GETADAPTERSINFO = 36;  
WSA_GETPERADAPTERINFO = 37;  
WSA_IPRELEASEADDRESS = 38;  
WSA_IPRENEWADDRESS = 39;  
WSA_SENDARP = 40;  
WSA_GETRTTANDHOPCOUNT = 41;  
WSA_GETFRIENDLYIFINDEX = 42;  
WSA_ENABLEROUTER = 43;  
WSA_UNENABLEROUTER = 44;  


Address info flag constants AI_*
Flags used in "hints" argument to getaddrinfo()
Note: Under Linux these values may be different
 
AI_PASSIVE = $00000001; Socket address will be used in bind() call
AI_CANONNAME = $00000002; Return canonical name from DNS in the first ai_canonname (Cannot be used with AI_FQDN)
AI_NUMERICHOST = $00000004; Nodename must be a numeric address string
AI_NUMERICSERV = $00000008; Servicename must be a numeric port string
AI_ALL = $00000100; Return both IPv6 and IPv4 addresses
AI_ADDRCONFIG = $00000400; Only return addresses if a global address is configured (IPv4 or IPv6), loopback addresses do not count as global.
AI_V4MAPPED = $00000800; Map returned IPv4 addresses to IPv6 address format
AI_NON_AUTHORITATIVE = $00004000; Allow both autoritive and non authoritive return addresses (NS_EMAIL only)
AI_SECURE = $00008000; Obtain result using enhanced security only (NS_EMAIL only)
AI_RETURN_PREFERRED_NAMES = $00010000; Return preferred names (NS_EMAIL only)
AI_FQDN = $00020000; Return the FQDN for the single name specified on NodeName (Cannot be used with AI_CANONNAME)
AI_FILESERVER = $00040000; The requested name is being used for file sharing (Hint Only)


Name info flag constants NI_*
Flags for getnameinfo()
 
NI_NOFQDN = $01; Only return nodename portion for local hosts
NI_NUMERICHOST = $02; Return numeric form of the host's address
NI_NAMEREQD = $04; Error if the host's name not in DNS
NI_NUMERICSERV = $08; Return numeric form of the service (port #)
NI_DGRAM = $10; Service is a datagram service
 
NI_MAXHOST = 1025; Max size of a fully-qualified domain name
NI_MAXSERV = 32; Max size of a service name


Type definitions


To be documented

Public variables


To be documented

Function declarations



Global socket functions

procedure FD_CLR(Socket: TSocket; var FDSet: TFDSet);
Description: To be documented
Note None documented


function FD_ISSET(Socket: TSocket; var FDSet: TFDSet): Boolean;
Description: To be documented
Note None documented


procedure FD_SET(Socket: TSocket; var FDSet: TFDSet);
Description: To be documented
Note None documented


procedure FD_ZERO(var FDSet: TFDSet);
Description: To be documented
Note None documented


function SequenceLT(A,B:LongInt):Boolean; inline;
Description: To be documented
Note None documented


function SequenceLEQ(A,B:LongInt):Boolean; inline;
Description: To be documented
Note None documented


function SequenceGT(A,B:LongInt):Boolean; inline;
Description: To be documented
Note None documented


function SequenceGEQ(A,B:LongInt):Boolean; inline;
Description: To be documented
Note None documented


function ProtocolToString(Protocol:Word):String;
Description: To be documented
Note None documented


Return to Unit Reference