Salut Steve Batson !
------------ Winsock.Pas Part 1/2 ---------------
unit Winsock;
{
Author: François PIETTE
Email: 2:293/2202@fidonet.org, fpiette@msn.com or BBS +32-41-651395
(+32-4-365.13.95 starting sept 14, 1996)
Creation: July 18, 1996
Object: Windows 16bit API Interface Unit for Delphi 1.x and
compatible with Borland Delphi 2.x Winsock
}
interface
uses WinTypes, WinProcs;
const
winsocket = 'WINSOCK.DLL';
{ Misc constants }
FD_SETSIZE = 64;
{
Commands for ioctlsocket(), taken from the BSD file fcntl.h.
Ioctl's have the command encoded in the lower word,
and the size of any in or out parameters in the upper
word. The high 2 bits of the upper word are used
to encode the in/out status of the parameter; for now
we restrict parameters to at most 128 bytes.
0x20000000 distinguishes new & old ioctl's
}
IOCPARM_MASK = $7f; { parameters must be < 128 bytes }
IOC_VOID = $20000000; { no parameters }
IOC_OUT = $40000000; { copy out parameters }
IOC_IN = $80000000; { copy in parameters }
IOC_INOUT = (IOC_IN + IOC_OUT);
FIONREAD = $4004667F; { get # bytes to read }
FIONBIO = $8004667E; { set/clear non-blocking i/o }
FIOASYNC = $8004667D; { set/clear async i/o }
{ Socket I/O Controls }
SIOCSHIWAT = $80047300; { set high watermark }
SIOCGHIWAT = $40047301; { set low watermark }
SIOCSLOWAT = $80047302; { set low watermark }
SIOCGLOWAT = $40047303; { get low watermark }
SIOCATMARK = $40047307; { at oob mark? }
INADDR_ANY = $00000000;
INADDR_LOOPBACK = $7f000001;
INADDR_BROADCAST = $ffffffff;
INADDR_NONE = $ffffffff;
WSADESCRIPTION_LEN = 256;
WSASYS_STATUS_LEN = 128;
{ Protocols }
IPPROTO_IP = 0; { dummy for IP }
IPPROTO_ICMP = 1; { control message protocol }
IPPROTO_GGP = 2; { gateway^2 (deprecated) }
IPPROTO_TCP = 6; { tcp }
IPPROTO_PUP = 12; { pup }
IPPROTO_UDP = 17; { user datagram protocol }
IPPROTO_IDP = 22; { xns idp }
IPPROTO_ND = 77; { UNOFFICIAL net disk proto }
IPPROTO_RAW = 255; { raw IP packet }
IPPROTO_MAX = 256;
{ 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 = 25;
IPPORT_TIMESERVER = 37;
IPPORT_NAMESERVER = 42;
IPPORT_WHOIS = 43;
IPPORT_MTP = 57;
{ 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;
{ Link numbers }
IMPLINK_IP = 155;
IMPLINK_LOWEXPER = 156;
IMPLINK_HIGHEXPER = 158;
INVALID_SOCKET = $ffff;
SOCKET_ERROR = (-1);
{ Types }
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 }
{ 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 = (not SO_LINGER);
{ 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 }
{ TCP options }
TCP_NODELAY = $0001;
{ Address families }
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_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_MAX = 18;
{ Protocol families, same as address families for now }
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_ISO = AF_ISO;
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_MAX = AF_MAX;
{ Level number for (get/set)sockopt() to apply to socket itself }
SOL_SOCKET = -1; { options for socket level }
{ Maximum queue length specifiable by listen }
SOMAXCONN = 5;
MSG_OOB = 1; { process out-of-band data }
MSG_PEEK = 2; { peek at incoming message }
MSG_DONTROUTE = 4; { send without using routing tables }
MSG_MAXIOVLEN = 16;
{ Define constant based on rfc883, used by gethostbyxxxx() calls }
MAXGETHOSTSTRUCT = 1024;
{ Define flags to be used with the WSAAsyncSelect() call }
FD_READ = 1;
FD_WRITE = 2;
FD_OOB = 4;
FD_ACCEPT = 8;
FD_CONNECT = 16;
FD_CLOSE = 32;
{ All Windows Sockets error constants are biased by WSABASEERR fromthe
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);
{ Extended Windows Sockets error constant definitions }
WSASYSNOTREADY = (WSABASEERR+91);
WSAVERNOTSUPPORTED = (WSABASEERR+92);
WSANOTINITIALISED = (WSABASEERR+93);
{ 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;
----- End of Winsock.Pas part 1/2 ------------
Amiti‚s,
{-Francois Piette-}
--- SvFido 1.32
---------------
* Origin: OverByte BBS (Embourg-Belgium) 32-41-651395 V-FAST (2:293/2202)
|