Unit
  W32Sock;

Interface

Uses
  Windows,
  kSockDef;

Function accept(_s: ULONG; _addr: pSockAddr; _addrlen: PInteger): ULONG; stdcall;
Function bind(_s: ULONG; _addr: pSockAddr; _namelen: Integer): Integer; stdcall;
Function MS_closesocket(_s: ULONG): Integer; stdcall;
Function connect(_s: ULONG; _name: pSockAddr; _namelen: Integer): Integer; stdcall;
Function ioctlsocket(_s: ULONG; _cmd: Longint; var _arg: ULONG): Integer; stdcall;
Function getpeername(_s: ULONG; _name: pSockAddr; var _namelen: Integer): Integer; stdcall;
Function getsockname(_s: ULONG; _name: pSockAddr; var _namelen: Integer): Integer; stdcall;
Function getsockopt(_s: ULONG; _level, _optname: Integer; _optval: PChar; var _optlen: Integer): Integer; stdcall;
Function htonl(_hostlong: ULONG): ULONG; stdcall;
Function htons(_hostshort: USHORT): USHORT; stdcall;
Function inet_addr(_cp: PChar): ULONG; stdcall;
Function inet_ntoa(_inaddr: tIn_Addr): PChar; stdcall;
Function listen(_s: ULONG; _backlog: Integer): Integer; stdcall;
Function ntohl(_netlong: ULONG): ULONG; stdcall;
Function ntohs(_netshort: USHORT): USHORT; stdcall;
Function recv(_s: ULONG; _Buf: pointer; _len, _flags: Integer): Integer; stdcall;
Function recvfrom(s: ULONG; _Buf: pointer; _len, _flags: Integer;
                  var _from: TSockAddr; var _fromlen: Integer): Integer; stdcall;
Function MS_select(_nfds: Integer; _readfds, _writefds, _exceptfds: PFDSet;
                   _timeout: PTimeVal): Longint; stdcall;
Function send(_s: ULONG; _Buf: pointer; _len, _flags: Integer): Integer; stdcall;
Function sendto(_s: ULONG; _Buf: pointer; _len, _flags: Integer; var _addrto: TSockAddr;
                _tolen: Integer): Integer; stdcall;
Function setsockopt(_s: ULONG; _level, _optname: Integer; _optval: PChar;
                    _optlen: Integer): Integer; stdcall;
Function shutdown(_s: ULONG; _how: Integer): Integer; stdcall;
Function socket(_af, _struct, _protocol: Integer): ULONG; stdcall;
Function gethostbyaddr(_addr: Pointer; _len, _struct: Integer): PHostEnt; stdcall;
Function gethostbyname(_name: PChar): PHostEnt; stdcall;
Function gethostname(_name: PChar; _len: Integer): Integer; stdcall;
Function getservbyport(_port: Integer; _proto: PChar): PServEnt; stdcall;
Function getservbyname(_name, _proto: PChar): PServEnt; stdcall;
Function getprotobynumber(_proto: Integer): PProtoEnt; stdcall;
Function getprotobyname(_name: PChar): PProtoEnt; stdcall;
Function MS_Startup(wVersionRequired: word; WSData: pWSAData): Integer; stdcall;
Function MS_Cleanup: Integer; stdcall;
Function MS_GetLastError: integer; stdcall;
Function MS_CancelBlockingCall: Integer; stdcall;

Implementation

Function accept;                external 'wsock32.dll' name 'accept';
Function bind;                  external 'wsock32.dll' name 'bind';
Function MS_closesocket;        external 'wsock32.dll' name 'closesocket';
Function connect;               external 'wsock32.dll' name 'connect';
Function getpeername;           external 'wsock32.dll' name 'getpeername';
Function getsockname;           external 'wsock32.dll' name 'getsockname';
Function getsockopt;            external 'wsock32.dll' name 'getsockopt';
Function htonl;                 external 'wsock32.dll' name 'htonl';
Function htons;                 external 'wsock32.dll' name 'htons';
Function inet_addr;             external 'wsock32.dll' name 'inet_addr';
Function inet_ntoa;             external 'wsock32.dll' name 'inet_ntoa';
Function ioctlsocket;           external 'wsock32.dll' name 'ioctlsocket';
Function listen;                external 'wsock32.dll' name 'listen';
Function ntohl;                 external 'wsock32.dll' name 'ntohl';
Function ntohs;                 external 'wsock32.dll' name 'ntohs';
Function recv;                  external 'wsock32.dll' name 'recv';
Function recvfrom;              external 'wsock32.dll' name 'recvfrom';
Function MS_select;             external 'wsock32.dll' name 'select';
Function send;                  external 'wsock32.dll' name 'send';
Function sendto;                external 'wsock32.dll' name 'sendto';
Function setsockopt;            external 'wsock32.dll' name 'setsockopt';
Function shutdown;              external 'wsock32.dll' name 'shutdown';
Function socket;                external 'wsock32.dll' name 'socket';

Function gethostbyaddr;         external 'wsock32.dll' name 'gethostbyaddr';
Function gethostbyname;         external 'wsock32.dll' name 'gethostbyname';
Function getprotobyname;        external 'wsock32.dll' name 'getprotobyname';
Function getprotobynumber;      external 'wsock32.dll' name 'getprotobynumber';
Function getservbyname;         external 'wsock32.dll' name 'getservbyname';
Function getservbyport;         external 'wsock32.dll' name 'getservbyport';
Function gethostname;           external 'wsock32.dll' name 'gethostname';
Function MS_Startup;            external 'wsock32.dll' name 'WSAStartup';
Function MS_Cleanup;            external 'wsock32.dll' name 'WSACleanup';
Function MS_GetLastError;       external 'wsock32.dll' name 'WSAGetLastError';
Function MS_CancelBlockingCall; external 'wsock32.dll' name 'WSACancelBlockingCall';

End.