Difference between revisions of "Unit Sockets"

From Ultibo.org
Jump to: navigation, search
Line 126: Line 126:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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> Esock*, EAI_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Socket error''' <code> Esock*, EAI_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 209: Line 209:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 shutdown option constants''' <code> SHUT_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Socket shutdown option''' <code> SHUT_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 226: Line 226:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''Socket type''' <code> SOCK_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 249: Line 249:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 input/output constants''' <code> S_IN* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Socket input/output''' <code> S_IN* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 265: Line 265:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''Address family''' <code> AF_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 368: Line 368:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''Protocol family''' <code> PF_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 468: Line 468:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''IP protocol''' <code> IPPROTO_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 533: Line 533:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''IP port''' <code> IPPORT_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 646: Line 646:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 option constants''' <code> IP_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''IP option''' <code> IP_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 688: Line 688:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''Socket option''' <code> SO_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 820: Line 820:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''TCP option''' <code> TCP_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 851: Line 851:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''UDP option''' <code> UDP_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 862: Line 862:
 
<br />   
 
<br />   
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''Message flag''' <code> MSG_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 889: Line 889:
 
<br />   
 
<br />   
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''Address info flag''' <code> AI_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 939: Line 939:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<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 style="font-size: 14px; padding-left: 12px;">'''Name info flag''' <code> NI_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 1,167: Line 1,167:
 
|}  
 
|}  
 
   
 
   
'''Socket address types'''
+
'''Socket address'''
  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">

Revision as of 03:57, 27 March 2017

Return to Unit Reference


Description


Ultibo Network Sockets interface unit

This unit includes the interface normally provided by the sockets unit in the FPC package rtl-extras. The rtl-extras package does not build the sockets unit for target Ultibo as this unit will always be available to provide the required functionality for any other package that uses it.

Constants



Sockets specific constants SOCKETS_*
SOCKETS_DEVICE_TIMER_INTERVAL = 500;  
 
SOCKETS_CONFIG_TIMER_INTERVAL = 1000;  
SOCKETS_FILTER_TIMER_INTERVAL = 1000;  
SOCKETS_PROTOCOL_TIMER_INTERVAL = 250; Previously 100
SOCKETS_SOCKET_TIMER_INTERVAL = 1000;  
SOCKETS_AUTH_TIMER_INTERVAL = 1000;  
SOCKETS_MONITOR_TIMER_INTERVAL = 1000;  
SOCKETS_TRANSPORT_TIMER_INTERVAL = 1000;  
SOCKETS_ADAPTER_TIMER_INTERVAL = 1000;  
 
INADDR_ANY = GlobalSock.INADDR_ANY;  
INADDR_NONE = GlobalSock.INADDR_NONE;  
 
Level number for (get/set)sockopt() to apply to socket itself
SOL_SOCKET = GlobalSock.SOL_SOCKET;  
 
Maximum queue length specifiable by listen
SOMAXCONN = GlobalSock.SOMAXCONN;  
 
This is used instead of -1, since the TSocket type is unsigned
INVALID_SOCKET = GlobalSock.INVALID_SOCKET;  
SOCKET_ERROR = GlobalSock.SOCKET_ERROR;  
 
INET_ADDRSTR_ANY = GlobalSock.INET_ADDRSTR_ANY;  
INET6_ADDRSTR_INIT = GlobalSock.INET6_ADDRSTR_INIT;  
 
INET_ADDRSTR_BROADCAST = GlobalSock.INET_ADDRSTR_BROADCAST;  
 
INET_ADDRSTRLEN = GlobalSock.INET_ADDRSTRLEN;  
INET6_ADDRSTRLEN = GlobalSock.INET6_ADDRSTRLEN;  
 
IN6ADDR_ANY_INIT:TIn6Addr = (u6_addr16: (0, 0, 0, 0, 0, 0, 0, 0));  
IN6ADDR_LOOPBACK_INIT:TIn6Addr = (u6_addr8: (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1));  
 
NoAddress: in_addr = (s_addr:0);  
NoNet: in_addr = (s_addr:0);  
NoAddress6: in6_addr = (u6_addr16:(0,0,0,0,0,0,0,0));  
NoNet6: in6_addr = (u6_addr16:(0,0,0,0,0,0,0,0));  


Socket error Esock*, EAI_*
EsockEINTR = WSAEINTR;  
EsockEBADF = WSAEBADF;  
EsockEFAULT = WSAEFAULT;  
EsockEINVAL = WSAEINVAL;  
EsockEACCESS = WSAEACCES;  
EsockEMFILE = WSAEMFILE;  
EsockEMSGSIZE = WSAEMSGSIZE;  
EsockENOBUFS = WSAENOBUFS;  
EsockENOTCONN = WSAENOTCONN;  
EsockENOTSOCK = WSAENOTSOCK;  
EsockEPROTONOSUPPORT = WSAEPROTONOSUPPORT;  
EsockEWOULDBLOCK = WSAEWOULDBLOCK;  
EsockADDRINUSE = WSAEADDRINUSE;  
 
Error codes from getaddrinfo()
EAI_AGAIN = GlobalSock.EAI_AGAIN;  
EAI_BADFLAGS = GlobalSock.EAI_BADFLAGS;  
EAI_FAIL = GlobalSock.EAI_FAIL;  
EAI_FAMILY = GlobalSock.EAI_FAMILY;  
EAI_MEMORY = GlobalSock.EAI_MEMORY;  
EAI_NODATA = GlobalSock.EAI_NODATA;  
EAI_NONAME = GlobalSock.EAI_NONAME;  
EAI_SERVICE = GlobalSock.EAI_SERVICE;  
EAI_SOCKTYPE = GlobalSock.EAI_SOCKTYPE;  
 
EAI_NODATA = GlobalSock.EAI_NODATA;  


Socket shutdown option SHUT_*
SHUT_RD = SD_RECEIVE; Aliases so we are cross-platform
SHUT_WR = SD_SEND;  
SHUT_RDWR = SD_BOTH;  


Socket type SOCK_*
SOCK_STREAM = GlobalSock.SOCK_STREAM;  
SOCK_DGRAM = GlobalSock.SOCK_DGRAM;  
SOCK_RAW = GlobalSock.SOCK_RAW;  
SOCK_RDM = GlobalSock.SOCK_RDM;  
SOCK_SEQPACKET = GlobalSock.SOCK_SEQPACKET;  


Socket input/output S_IN*
Two constants to determine whether part of socket is for in or output
S_IN = 0;  
S_OUT = 1;  


Address family AF_*
AF_UNSPEC = GlobalSock.AF_UNSPEC;  
AF_UNIX = GlobalSock.AF_UNIX;  
AF_INET = GlobalSock.AF_INET;  
AF_IMPLINK = GlobalSock.AF_IMPLINK;  
AF_PUP = GlobalSock.AF_PUP;  
AF_CHAOS = GlobalSock.AF_CHAOS;  
AF_IPX = GlobalSock.AF_IPX;  
AF_NS = GlobalSock.AF_NS;  
AF_ISO = GlobalSock.AF_ISO;  
AF_OSI = GlobalSock.AF_OSI;  
AF_ECMA = GlobalSock.AF_ECMA;  
AF_DATAKIT = GlobalSock.AF_DATAKIT;  
AF_CCITT = GlobalSock.AF_CCITT;  
AF_SNA = GlobalSock.AF_SNA;  
AF_DECnet = GlobalSock.AF_DECnet;  
AF_DLI = GlobalSock.AF_DLI;  
AF_LAT = GlobalSock.AF_LAT;  
AF_HYLINK = GlobalSock.AF_HYLINK;  
AF_APPLETALK = GlobalSock.AF_APPLETALK;  
AF_NETBIOS = GlobalSock.AF_NETBIOS;  
AF_VOICEVIEW = GlobalSock.AF_VOICEVIEW;  
AF_FIREFOX = GlobalSock.AF_FIREFOX;  
AF_UNKNOWN1 = GlobalSock.AF_UNKNOWN1;  
AF_BAN = GlobalSock.AF_BAN;  
AF_ATM = GlobalSock.AF_ATM;  
AF_INET6 = GlobalSock.AF_INET6;  
AF_CLUSTER = GlobalSock.AF_CLUSTER;  
AF_12844 = GlobalSock.AF_12844;  
AF_IRDA = GlobalSock.AF_IRDA;  
AF_NETDES = GlobalSock.AF_NETDES;  
 
AF_MAX = GlobalSock.AF_MAX;  


Protocol family PF_*
PF_UNSPEC = GlobalSock.PF_UNSPEC;  
PF_UNIX = GlobalSock.PF_UNIX;  
PF_INET = GlobalSock.PF_INET;  
PF_IMPLINK = GlobalSock.PF_IMPLINK;  
PF_PUP = GlobalSock.PF_PUP;  
PF_CHAOS = GlobalSock.PF_CHAOS;  
PF_NS = GlobalSock.PF_NS;  
PF_IPX = GlobalSock.PF_IPX;  
PF_ISO = GlobalSock.PF_ISO;  
PF_OSI = GlobalSock.PF_OSI;  
PF_ECMA = GlobalSock.PF_ECMA;  
PF_DATAKIT = GlobalSock.PF_DATAKIT;  
PF_CCITT = GlobalSock.PF_CCITT;  
PF_SNA = GlobalSock.PF_SNA;  
PF_DECnet = GlobalSock.PF_DECnet;  
PF_DLI = GlobalSock.PF_DLI;  
PF_LAT = GlobalSock.PF_LAT;  
PF_HYLINK = GlobalSock.PF_HYLINK;  
PF_APPLETALK = GlobalSock.PF_APPLETALK;  
PF_VOICEVIEW = GlobalSock.PF_VOICEVIEW;  
PF_FIREFOX = GlobalSock.PF_FIREFOX;  
PF_UNKNOWN1 = GlobalSock.PF_UNKNOWN1;  
PF_BAN = GlobalSock.PF_BAN;  
PF_ATM = GlobalSock.PF_ATM;  
PF_INET6 = GlobalSock.PF_INET6;  
PF_CLUSTER = GlobalSock.PF_CLUSTER;  
PF_12844 = GlobalSock.PF_12844;  
PF_IRDA = GlobalSock.PF_IRDA;  
PF_NETDES = GlobalSock.PF_NETDES;  
 
PF_MAX = GlobalSock.PF_MAX;  


IP protocol IPPROTO_*
IPPROTO_IP = GlobalSock.IPPROTO_IP;  
IPPROTO_ICMP = GlobalSock.IPPROTO_ICMP;  
IPPROTO_IGMP = GlobalSock.IPPROTO_IGMP;  
IPPROTO_GGP = GlobalSock.IPPROTO_GGP;  
IPPROTO_TCP = GlobalSock.IPPROTO_TCP;  
IPPROTO_EGP = GlobalSock.IPPROTO_EGP;  
IPPROTO_PUP = GlobalSock.IPPROTO_PUP;  
IPPROTO_UDP GlobalSock.IPPROTO_UDP;  
IPPROTO_HMP = GlobalSock.IPPROTO_HMP;  
IPPROTO_IDP = GlobalSock.IPPROTO_IDP;  
IPPROTO_RDP = GlobalSock.IPPROTO_RDP;  
IPPROTO_IPV6 = GlobalSock.IPPROTO_IPV6;  
IPPROTO_ROUTING = GlobalSock.IPPROTO_ROUTING;  
IPPROTO_FRAGMENT = GlobalSock.IPPROTO_FRAGMENT;  
IPPROTO_ICMPV6 = GlobalSock.IPPROTO_ICMPV6;  
IPPROTO_RVD = GlobalSock.IPPROTO_RVD;  
IPPROTO_ND = GlobalSock.IPPROTO_ND;  
IPPROTO_RAW = GlobalSock.IPPROTO_RAW;  
IPPROTO_MAX = GlobalSock.IPPROTO_MAX;  


IP port IPPORT_*
Port/socket numbers: network standard functions
IPPORT_ANY = GlobalSock.IPPORT_ANY;  
IPPORT_ECHO = GlobalSock.IPPORT_ECHO;  
IPPORT_DISCARD = GlobalSock.IPPORT_DISCARD;  
IPPORT_SYSTAT = GlobalSock.IPPORT_SYSTAT;  
IPPORT_DAYTIME = GlobalSock.IPPORT_DAYTIME;  
IPPORT_NETSTAT = GlobalSock.IPPORT_NETSTAT;  
IPPORT_FTP = GlobalSock.IPPORT_FTP;  
IPPORT_TELNET = GlobalSock.IPPORT_TELNET;  
IPPORT_SMTP = GlobalSock.IPPORT_SMTP;  
IPPORT_TIMESERVER = GlobalSock.IPPORT_TIMESERVER;  
IPPORT_NAMESERVER = GlobalSock.IPPORT_NAMESERVER;  
IPPORT_WHOIS = GlobalSock.IPPORT_WHOIS;  
IPPORT_DNS = GlobalSock.IPPORT_DNS;  
IPPORT_MTP= GlobalSock.IPPORT_MTP;  
IPPORT_BOOTPS = GlobalSock.IPPORT_BOOTPS;  
IPPORT_BOOTPC = GlobalSock.IPPORT_BOOTPC;  
 
Port/socket numbers: host specific functions
IPPORT_TFTP = GlobalSock.IPPORT_TFTP;  
IPPORT_RJE = GlobalSock.IPPORT_RJE;  
IPPORT_FINGER = GlobalSock.IPPORT_FINGER;  
IPPORT_TTYLINK = GlobalSock.IPPORT_TTYLINK;  
IPPORT_SUPDUP = GlobalSock.IPPORT_SUPDUP;  
 
UNIX TCP sockets
IPPORT_EXECSERVER = GlobalSock.IPPORT_EXECSERVER;  
IPPORT_LOGINSERVER = GlobalSock.IPPORT_LOGINSERVER;  
IPPORT_CMDSERVER = GlobalSock.IPPORT_CMDSERVER;  
IPPORT_EFSSERVER = GlobalSock.IPPORT_EFSSERVER;  
 
UNIX UDP sockets
IPPORT_BIFFUDP = GlobalSock.IPPORT_BIFFUDP;  
IPPORT_WHOSERVER = GlobalSock.IPPORT_WHOSERVER;  
IPPORT_ROUTESERVER = GlobalSock.IPPORT_ROUTESERVER;  
 
Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root)
IPPORT_RESERVED = GlobalSock.IPPORT_RESERVED;  


IP option IP_*
Options for use with [gs]etsockopt at the IP level
 
IP_OPTIONS = GlobalSock.IP_OPTIONS;  
IP_MULTICAST_IF = GlobalSock.IP_MULTICAST_IF;  
IP_MULTICAST_TTL = GlobalSock.IP_MULTICAST_TTL;  
IP_MULTICAST_LOOP = GlobalSock.IP_MULTICAST_LOOP;  
IP_ADD_MEMBERSHIP = GlobalSock.IP_ADD_MEMBERSHIP;  
IP_DROP_MEMBERSHIP = GlobalSock.IP_DROP_MEMBERSHIP;  
IP_TTL = GlobalSock.IP_TTL;  
IP_TOS = GlobalSock.IP_TOS;  
IP_DONTFRAGMENT = GlobalSock.IP_DONTFRAGMENT;  
IP_HDRINCL = GlobalSock.IP_HDRINCL;  


Socket option SO_*
Option flags per-socket
 
SO_DEBUG = GlobalSock.SO_DEBUG;  
SO_ACCEPTCONN = GlobalSock.SO_ACCEPTCONN;  
SO_REUSEADDR = GlobalSock.SO_REUSEADDR;  
SO_KEEPALIVE = GlobalSock.SO_KEEPALIVE;  
SO_DONTROUTE = GlobalSock.SO_DONTROUTE;  
SO_BROADCAST = GlobalSock.SO_BROADCAST;  
SO_USELOOPBACK = GlobalSock.SO_USELOOPBACK;  
SO_LINGER = GlobalSock.SO_LINGER;  
SO_OOBINLINE = GlobalSock.SO_OOBINLINE;  
 
SO_DONTLINGER = GlobalSock.SO_DONTLINGER;  
 
Additional options
SO_SNDBUF = GlobalSock.SO_SNDBUF;  
SO_RCVBUF = GlobalSock.SO_RCVBUF;  
SO_SNDLOWAT = GlobalSock.SO_SNDLOWAT;  
SO_RCVLOWAT = GlobalSock.SO_RCVLOWAT;  
SO_SNDTIMEO = GlobalSock.SO_SNDTIMEO;  
SO_RCVTIMEO = GlobalSock.SO_RCVTIMEO;  
SO_ERROR = GlobalSock.SO_ERROR;  
SO_TYPE = GlobalSock.SO_TYPE;  
SO_CONNTIMEO = GlobalSock.SO_CONNTIMEO;  
 
Options for connect and disconnect data and options. Used only by non-TCP/IP transports such as DECNet, OSI TP4, etc.
SO_CONNDATA = GlobalSock.SO_CONNDATA;  
SO_CONNOPT = GlobalSock.SO_CONNOPT;  
SO_DISCDATA = GlobalSock.SO_DISCDATA;  
SO_DISCOPT = GlobalSock.SO_DISCOPT;  
SO_CONNDATALEN = GlobalSock.SO_CONNDATALEN;  
SO_CONNOPTLEN = GlobalSock.SO_CONNOPTLEN;  
SO_DISCDATALEN = GlobalSock.SO_DISCDATALEN;  
SO_DISCOPTLEN = GlobalSock.SO_DISCOPTLEN;  
 
Options for opening sockets for synchronous access
SO_OPENTYPE = GlobalSock.SO_OPENTYPE;  
SO_SYNCHRONOUS_ALERT = GlobalSock.SO_SYNCHRONOUS_ALERT;  
SO_SYNCHRONOUS_NONALERT = GlobalSock.SO_SYNCHRONOUS_NONALERT;  
 
Other NT-specific options
SO_MAXDG = GlobalSock.SO_MAXDG;  
SO_MAXPATHDG = GlobalSock.SO_MAXPATHDG;  
SO_UPDATE_ACCEPT_CONTEXT = GlobalSock.SO_UPDATE_ACCEPT_CONTEXT;  
SO_CONNECT_TIME = GlobalSock.SO_CONNECT_TIME;  


TCP option TCP_*
TCP_NODELAY = GlobalSock.TCP_NODELAY;  
TCP_MAXSEG = GlobalSock.TCP_MAXSEG;  
TCP_NOPUSH = GlobalSock.TCP_NOPUSH;  
TCP_NOOPT = GlobalSock.TCP_NOOPT;  
TCP_BSDURGENT = GlobalSock.TCP_BSDURGENT;  
 
TCP_WSCALE = GlobalSock.TCP_WSCALE;  
TCP_NOSACK = GlobalSock.TCP_NOSACK;  


UDP option UDP_*
UDP_NOCHECKSUM = GlobalSock.UDP_NOCHECKSUM;  


Message flag MSG_*
MSG_OOB = GlobalSock.MSG_OOB;  
MSG_PEEK = GlobalSock.MSG_PEEK;  
MSG_DONTROUTE = GlobalSock.MSG_DONTROUTE;  
 
MSG_INTERRUPT = GlobalSock.MSG_INTERRUPT;  
 
MSG_PARTIAL = GlobalSock.MSG_PARTIAL;  


Address info flag AI_*
Flags used in "hints" argument to getaddrinfo()
Note: Under Linux these values may be different
 
AI_PASSIVE = GlobalSock.AI_PASSIVE;  
AI_CANONNAME = GlobalSock.AI_CANONNAME;  
AI_NUMERICHOST = GlobalSock.AI_NUMERICHOST;  
AI_NUMERICSERV = GlobalSock.AI_NUMERICSERV;  
AI_ALL = GlobalSock.AI_ALL;  
AI_ADDRCONFIG = GlobalSock.AI_ADDRCONFIG;  
AI_V4MAPPED = GlobalSock.AI_V4MAPPED;  
AI_NON_AUTHORITATIVE = GlobalSock.AI_NON_AUTHORITATIVE;  
AI_SECURE = GlobalSock.AI_SECURE;  
AI_RETURN_PREFERRED_NAMES = GlobalSock.AI_RETURN_PREFERRED_NAMES;  
AI_FQDN = GlobalSock.AI_FQDN;  
AI_FILESERVER = GlobalSock.AI_FILESERVER;  


Name info flag NI_*
Flags for getnameinfo()
 
NI_NOFQDN = GlobalSock.NI_NOFQDN;  
NI_NUMERICHOST = GlobalSock.NI_NUMERICHOST;  
NI_NAMEREQD = GlobalSock.NI_NAMEREQD;  
NI_NUMERICSERV = GlobalSock.NI_NUMERICSERV;  
NI_DGRAM = GlobalSock.NI_DGRAM;  
 
NI_MAXHOST = GlobalSock.NI_MAXHOST;  
NI_MAXSERV = GlobalSock.NI_MAXSERV;  


Type definitions



Sockets device event

PSocketsDeviceEvent = ^TSocketsDeviceEvent;

TSocketsDeviceEvent = record

Timer:TTimerHandle;  
Device:PNetworkDevice;  

Numeric types

cushort = Word;
sa_family_t = cushort;

Integer types

cuint8 = Byte;
cuint16 = Word;
cuint32 = Cardinal;
size_t = GlobalTypes.SIZE_T; cuint32;
ssize_t = cuint16;
cint = LongInt;
pcint = ^cint;

Socket length

tsocklen = cint;
psocklen = ^tsocklen;

IPv4 address

pin_addr = ^in_addr;
in_addr = GlobalSock.in_addr;
TIn_addr = in_addr;
TInAddr = GlobalSock.TInAddr;
PInAddr = GlobalSock.PInAddr;

Internet socket address

TInetSockAddr = sockaddr_in;
PInetSockAddr = psockaddr_in;

Socket address

psockaddr = GlobalSock.psockaddr;
sockaddr = GlobalSock.TSockAddr;
TSockAddr = GlobalSock.TSockAddr;
psockaddr_in = ^sockaddr_in;
sockaddr_in = GlobalSock.sockaddr_in;

Linger

plinger = GlobalSock.plinger;
linger = GlobalSock.linger;
TLinger = GlobalSock.TLinger;

IPv6 address

pin6_addr = ^in6_addr;
in6_addr = GlobalSock.in6_addr;
Tin6_addr = in6_addr;
TIn6Addr = GlobalSock.TIn6Addr;
PIn6Addr = GlobalSock.PIn6Addr;

Socket address IPv6

psockaddr_in6 = ^sockaddr_in6;
sockaddr_in6 = GlobalSock.sockaddr_in6;
TInetSockAddr6 = sockaddr_in6;
PInetSockAddr6 = psockaddr_in6;

Socket pair

TSockPairArray = array[0..1] of Longint;
TSockArray = array[1..2] of Longint; Legacy

Socket address

psockaddr_un = ^sockaddr_un;

sockaddr_un = packed record

sun_family:sa_family_t;  
sun_path:array[0..107] of char;  

Address information

PAddrInfo = GlobalSock.PAddrInfo;
TAddrInfo = GlobalSock.TAddrInfo;


Public variables


None defined

Function declarations



Initialization functions

procedure SocketsInit;
Description: To be documented
Note None documented


function SocketsStart:LongWord;
Description: To be documented
Note None documented


function SocketsStop:LongWord;
Description: To be documented
Note None documented


procedure SocketsAsyncStart(Data:Pointer);
Description: To be documented
Note None documented


Sockets functions

function SocketError: cint;
Description: To be documented
Note None documented


function Socket(Domain,SocketType,Protocol:Longint):Longint;
Description: To be documented
Note None documented


function Send(Sock:Longint; const Buf; BufLen,Flags:Longint):Longint;
Description: To be documented
Note None documented


function SendTo(Sock:Longint; const Buf; BufLen,Flags:Longint; var Addr; AddrLen : Longint):Longint;
Description: To be documented
Note None documented


function Recv(Sock:Longint; var Buf; BufLen,Flags:Longint):Longint;
Description: To be documented
Note None documented


function RecvFrom(Sock : Longint; var Buf; Buflen,Flags : Longint; var Addr; var AddrLen : longint) : longint;
Description: To be documented
Note None documented


function Connect(Sock:Longint; const Addr; Addrlen:Longint):Boolean;
Description: To be documented
Note None documented


function Shutdown(Sock:Longint; How:Longint):Longint;
Description: To be documented
Note None documented


function Bind(Sock:Longint; const Addr; AddrLen:Longint):Boolean;
Description: To be documented
Note None documented


function Listen(Sock,MaxConnect:Longint):Boolean;
Description: To be documented
Note None documented


function Accept(Sock:Longint; var Addr; var Addrlen:Longint):Longint;
Description: To be documented
Note None documented


function GetSocketName(Sock:Longint; var Addr; var Addrlen:Longint):Longint;
Description: To be documented
Note None documented


function GetPeerName(Sock:Longint; var Addr; var Addrlen:Longint):Longint;
Description: To be documented
Note None documented


function GetSocketOptions(Sock,Level,OptName:Longint; var OptVal; var optlen:longint):Longint;
Description: To be documented
Note None documented


function SetSocketOptions(Sock,Level,OptName:Longint; const OptVal; optlen:longint):Longint;
Description: To be documented
Note None documented


function SocketPair(Domain,SocketType,Protocol:Longint; var Pair:TSockArray):Longint;
Description: To be documented
Note None documented


function CloseSocket(Sock:Longint):Longint;
Description: To be documented
Note None documented


function Inet_Addr(cp: PChar): Longint;
Description: To be documented
Note None documented


function Inet_Ntoa(inaddr: TInAddr): PChar;
Description: To be documented
Note As per the Winsock specification, the buffer returned by this function is only guaranteed to be valid until the next Sockets function call is made within the same thread. Therefore, the data should be copied before another Sockets call


function Inet_Pton(family: Longint; Source: PChar; Dest: Pointer): Longint;
Description: To be documented
Note None documented


function Inet_Ntop(family: Longint; Source: Pointer; Dest: PChar; Size: Longint): PChar;
Description: To be documented
Note None documented


function GetHostByAddr(addr: Pointer; len, family: Longint): PHostEnt;
Description: To be documented
Note None documented


function GetHostByName(name: PChar): PHostEnt;
Description: To be documented
Note None documented


function GetHostName(name: PChar; len: Longint): Longint;
Description: To be documented
Note None documented


function GetNetByAddr(addr: Pointer; len, Struct: Integer): PNetEnt;
Description: To be documented
Note None documented


function GetNetByName(name: PChar): PNetEnt;
Description: To be documented
Note None documented


function GetServByPort(port: Longint; proto: PChar): PServEnt;
Description: To be documented
Note None documented


function GetServByName(name, proto: PChar): PServEnt;
Description: To be documented
Note None documented


function GetProtoByNumber(proto: Longint): PProtoEnt;
Description: To be documented
Note None documented


function GetProtoByName(name: PChar): PProtoEnt;
Description: To be documented
Note None documented


function GetAddrInfo(HostName, ServName: PChar; Hints: PAddrInfo; var Addr: PAddrInfo): Longint;
Description: To be documented
Note None documented


procedure FreeAddrInfo(ai: PAddrInfo);
Description: To be documented
Note None documented


function GetNameInfo(sa: PSockAddr; salen: Longint; host: PChar; hostlen: DWORD; serv: PChar; servlen: DWORD; flags: Longint): Longint;
Description: To be documented
Note None documented


RTL sockets functions

function fpsocket(domain:cint; xtype:cint; protocol: cint):cint;
Description: To be documented
Note None documented


function fpsend(s:cint; msg:pointer; len:size_t; flags:cint):ssize_t;
Description: To be documented
Note None documented


function fpsendto(s:cint; msg:pointer; len:size_t; flags:cint; tox :psockaddr; tolen: tsocklen):ssize_t;
Description: To be documented
Note None documented


function fprecv(s:cint; buf: pointer; len: size_t; flags: cint):ssize_t;
Description: To be documented
Note None documented


function fprecvfrom(s:cint; buf: pointer; len: size_t; flags: cint; from : psockaddr; fromlen : psocklen):ssize_t;
Description: To be documented
Note None documented


function fpconnect(s:cint; name  : psockaddr; namelen : tsocklen):cint;
Description: To be documented
Note None documented


function fpshutdown(s:cint; how:cint):cint;
Description: To be documented
Note None documented


function fpbind(s:cint; addrx : psockaddr; addrlen : tsocklen):cint;
Description: To be documented
Note None documented


function fplisten(s:cint; backlog : cint):cint;
Description: To be documented
Note None documented


function fpaccept(s:cint; addrx : psockaddr; addrlen : psocklen):cint;
Description: To be documented
Note None documented


function fpgetsockname(s:cint; name  : psockaddr; namelen : psocklen):cint;
Description: To be documented
Note None documented


function fpgetpeername(s:cint; name  : psockaddr; namelen : psocklen):cint;
Description: To be documented
Note None documented


function fpgetsockopt(s:cint; level:cint; optname:cint; optval:pointer; optlen : psocklen):cint;
Description: To be documented
Note None documented


function fpsetsockopt(s:cint; level:cint; optname:cint; optval:pointer; optlen :tsocklen):cint;
Description: To be documented
Note None documented


function fpsocketpair(d:cint; xtype:cint; protocol:cint; sv:pcint):cint;
Description: To be documented
Note None documented


RTL File/Text sockets functions

function fpRead(Handle:LongInt; var BufPtr; Size:DWORD):DWORD;
Description: To be documented
Note None documented


function fpWrite(Handle:LongInt; var BufPtr; Size:DWORD):DWORD;
Description: To be documented
Note None documented


procedure OpenSock(var F:Text);
Description: To be documented
Note None documented


procedure IOSock(var F:Text);
Description: To be documented
Note None documented


procedure FlushSock(var F:Text);
Description: To be documented
Note None documented


procedure CloseSock(var F:text);
Description: To be documented
Note None documented


procedure Sock2Text(Sock:Longint; Var SockIn,SockOut:Text);
Description: Set up two Pascal Text file descriptors for reading and writing
Note None documented


function DoAccept(Sock:longint; var addr:TInetSockAddr):longint;
Description: To be documented
Note None documented


function Accept(Sock:longint; var addr:TInetSockAddr; var SockIn,SockOut:File):Boolean;
Description: To be documented
Note None documented


function Accept(Sock:longint; var addr:TInetSockAddr; var SockIn,SockOut:text):Boolean;
Description: To be documented
Note None documented


function DoConnect(Sock:longint; const addr:TInetSockAddr):Boolean;
Description: To be documented
Note None documented


function Connect(Sock:longint; const addr:TInetSockAddr; var SockIn,SockOut:text):Boolean;
Description: To be documented
Note None documented


function Connect(Sock:longint; const addr:TInetSockAddr; var SockIn,SockOut:file):Boolean;
Description: To be documented
Note None documented


procedure Sock2File(Sock:Longint; Var SockIn,SockOut:File);
Description: To be documented
Note None documented


Sockets helper functions

procedure SocketsProcessConfig(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsProcessFilter(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsProcessProtocol(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsProcessSocket(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsProcessAuth(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsProcessMonitor(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsProcessTransport(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsProcessAdapter(Data:Pointer);
Description: To be documented
Note None documented


procedure SocketsNetworkDeviceAdd(Event:PSocketsDeviceEvent);
Description: To be documented
Note None documented


function SocketsNetworkDeviceRemove(Network:PNetworkDevice):LongWord;
Description: To be documented
Note None documented


function SocketsNetworkDeviceEnum(Network:PNetworkDevice; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function SocketsNetworkDeviceNotify(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
Description: To be documented
Note None documented


RTL sockets helper functions

function htonl(host:cardinal):cardinal; inline;
Description: To be documented
Note None documented


function ntohl(net:cardinal):cardinal; inline;
Description: To be documented
Note None documented


function htons(host:word):word; inline;
Description: To be documented
Note None documented


function ntohs(net:word):word; inline;
Description: To be documented
Note None documented


function NetAddrToStr(Entry:in_addr):AnsiString;
Description: To be documented
Note None documented


function HostAddrToStr(Entry:in_addr):AnsiString;
Description: To be documented
Note None documented


function StrToHostAddr(IP:AnsiString):in_addr;
Description: To be documented
Note None documented


function StrToNetAddr(IP:AnsiString):in_addr;
Description: To be documented
Note None documented


function HostToNet(Host:in_addr):in_addr;
Description: To be documented
Note None documented


function NetToHost(Net:in_addr):in_addr;
Description: To be documented
Note None documented


function HostToNet(Host:Longint):Longint;
Description: To be documented
Note None documented


function NetToHost(Net:Longint):Longint;
Description: To be documented
Note None documented


function ShortHostToNet(Host:Word):Word;
Description: To be documented
Note None documented


function ShortNetToHost(Net:Word):Word;
Description: To be documented
Note None documented


function LocalIntToHex(Value:Integer; Digits:LongInt):AnsiString;
Description: To be documented
Note None documented


function HostAddrToStr6(Entry:Tin6_addr):AnsiString;
Description: To be documented
Note None documented


function StrToHostAddr6(IP:String):Tin6_addr; 
Description: To be documented
Note None documented


function NetAddrToStr6(Entry:Tin6_addr):AnsiString;
Description: To be documented
Note None documented


function StrToNetAddr6(IP:AnsiString):TIn6_Addr;
Description: To be documented
Note None documented


Return to Unit Reference