Unit Winsock
From Ultibo.org
Return to Unit Reference
Contents
[hide]Description
Ultibo Winsock Interface unit
Notes:
- All BSD/Winsock functions that accept an Address or Port expect them to be in Network byte order.
- All other functions that take an Address or Port expect them to be in Host byte order.
Constants
[Expand]
Winsock specific constants
WINSOCK_*
[Expand]
IP protocol
IPPROTO_*
[Expand]
IP port
IPPORT_*
[Expand]
IP option
IP_*
[Expand]
Socket type
SOCK_*
[Expand]
Socket option
SO_*
[Expand]
TCP option
TCP_*
[Expand]
UDP option
UDP_*
[Expand]
Address family
AF_*
[Expand]
Protocol family
PF_*
[Expand]
Message flag
MSG_*
[Expand]
WSAAsyncSelect flag
FD_*
[Expand]
Socket error
WSAE*
[Expand]
WsControlEx option
WSA_*
Type definitions
See globalsock.pas
Public variables
None defined
Function declarations
Initialization functions
Winsock functions
[Expand]
function accept(s: TSocket; addr: PSockAddr; addrlen : ptOS_INT) : TSocket;
Description: Accept an incoming connection attempt on a socket
[Expand]
function accept(s: TSocket; addr: PSockAddr; var addrlen : tOS_INT) : TSocket;
Description: Accept an incoming connection attempt on a socket
[Expand]
function bind(s: TSocket; addr: PSockaddr; namelen:tOS_INT):tOS_INT;
Description: Associate a local address with a socket
[Expand]
function bind(s: TSocket; var addr: TSockaddr; namelen:tOS_INT):tOS_INT;
Description: Associate a local address with a socket
[Expand]
function connect(s: TSocket; addr:PSockAddr; namelen:tOS_INT):tOS_INT;
Description: Establish a connection to a specified socket
[Expand]
function connect(s: TSocket; var name:TSockAddr; namelen:tOS_INT):tOS_INT;
Description: Establish a connection to a specified socket
[Expand]
function ioctlsocket(s: TSocket; cmd:longint; var arg:u_long):tOS_INT;
Description: Control the I/O mode of a socket
[Expand]
function ioctlsocket(s: TSocket; cmd:longint; var arg:longint):tOS_INT;
Description: Control the I/O mode of a socket
[Expand]
function ioctlsocket(s: TSocket; cmd:longint; argp:pu_long):tOS_INT;
Description: Control the I/O mode of a socket
[Expand]
function getpeername(s: TSocket; var name:TSockAddr; var namelen:tOS_INT):tOS_INT;
Description: Retrieve the address of the peer to which a socket is connected
[Expand]
function getsockname(s: TSocket; var name:TSockAddr; var namelen:tOS_INT):tOS_INT;
Description: Retrieve the local name for a socket
[Expand]
function getsockopt(s: TSocket; level:tOS_INT; optname:tOS_INT; optval:pchar; var optlen:tOS_INT):tOS_INT;
Description: Retrieve a socket option
[Expand]
function getsockopt(s: TSocket; level:tOS_INT; optname:tOS_INT; optval:pointer; var optlen:tOS_INT):tOS_INT;
Description: Retrieve a socket option
[Expand]
function getsockopt(s: TSocket; level:tOS_INT; optname:tOS_INT; var optval; var optlen:tOS_INT):tOS_INT;
Description: Retrieve a socket option
[Expand]
function htonl(hostlong: u_long): u_long;
Description: Convert a u_long from host byte order to TCP/IP network byte order (which is big-endian)
[Expand]
function htons(hostshort: u_short): u_short;
Description: Convert a u_short from host byte order to TCP/IP network byte order (which is big-endian)
[Expand]
function inet_addr(cp: PChar): u_long;
Description: Convert a string containing an IPv4 dotted-decimal address into a proper address for the IN_ADDR structure
[Expand]
function inet_ntoa(inaddr: TInAddr): PChar;
Description: Convert an (IPv4) Internet network address into an ASCII string in Internet standard dotted-decimal format
[Expand]
function listen(s: TSocket; backlog:tOS_INT):tOS_INT;
Description: Place a socket in a state in which it is listening for incoming connections
[Expand]
function ntohl(netlong: u_long): u_long;
Description: Convert a u_long from TCP/IP network byte order to host byte order
[Expand]
function ntohs(netshort: u_short): u_short;
Description: Convert a u_short from TCP/IP network byte order to host byte order
[Expand]
function recv(s: TSocket; buf:pchar; len:tOS_INT; flags:tOS_INT):tOS_INT;
Description: Receive data from a connected socket or a bound connectionless socket
[Expand]
function recv(s: TSocket; buf:pointer; len:tOS_INT; flags:tOS_INT):tOS_INT;
Description: Receive data from a connected socket or a bound connectionless socket
[Expand]
function recv(s: TSocket; var buf; len:tOS_INT; flags:tOS_INT):tOS_INT;
Description: Receive data from a connected socket or a bound connectionless socket
[Expand]
function recvfrom(s: TSocket; buf:pchar; len:tOS_INT; flags:tOS_INT; from:PSockAddr; fromlen:ptOS_INT):tOS_INT;
Description: Receive a datagram and store the source address
[Expand]
function recvfrom(s: TSocket; buf:pointer; len:tOS_INT; flags:tOS_INT; from:PSockAddr; fromlen:ptOS_INT):tOS_INT;
Description: Receive a datagram and store the source address
[Expand]
function recvfrom(s: TSocket; var buf; len:tOS_INT; flags:tOS_INT; var from:TSockAddr; var fromlen:tOS_INT):tOS_INT;
Description: Receive a datagram and store the source address
[Expand]
function select(nfds:tOS_INT; readfds,writefds,exceptfds : PFDSet;timeout: PTimeVal):tOS_INT;
Description: Determine the status of one or more sockets, waiting if necessary, to perform synchronous I/O
[Expand]
function send(s: TSocket;var buf; len:tOS_INT; flags:tOS_INT):tOS_INT;
Description: Send data on a connected socket
[Expand]
function send(s: TSocket; buf:pchar; len:tOS_INT; flags:tOS_INT):tOS_INT;
Description: Send data on a connected socket
[Expand]
function send(s: TSocket;buf:pointer; len:tOS_INT; flags:tOS_INT):tOS_INT;
Description: Send data on a connected socket
[Expand]
function sendto(s: TSocket; buf:pchar; len:tOS_INT; flags:tOS_INT; toaddr:PSockAddr; tolen:tOS_INT):tOS_INT;
Description: Send data to a specific destination
[Expand]
function sendto(s: TSocket; buf:pointer; len:tOS_INT; flags:tOS_INT; toaddr:PSockAddr; tolen:tOS_INT):tOS_INT;
Description: Send data to a specific destination
[Expand]
function sendto(s: TSocket; var buf; len:tOS_INT; flags:tOS_INT; var toaddr:TSockAddr; tolen:tOS_INT):tOS_INT;
Description: Send data to a specific destination
[Expand]
function setsockopt(s: TSocket; level:tOS_INT; optname:tOS_INT; optval:pchar; optlen:tOS_INT):tOS_INT;
Description: Set a socket option
[Expand]
function setsockopt(s: TSocket; level:tOS_INT; optname:tOS_INT; optval:pointer; optlen:tOS_INT):tOS_INT;
Description: Set a socket option
[Expand]
function setsockopt(s: TSocket; level:tOS_INT; optname:tOS_INT; var optval; optlen:tOS_INT):tOS_INT;
Description: Set a socket option
[Expand]
function shutdown(s: TSocket; how:tOS_INT):tOS_INT;
Description: Disable sends or receives on a socket
[Expand]
function socket(af:tOS_INT; struct:tOS_INT; protocol:tOS_INT):TSocket;
Description: Create a socket that is bound to a specific transport service provider
[Expand]
function gethostbyaddr(addr:pchar; len:tOS_INT; family:tOS_INT): PHostEnt;
Description: Retrieve the host information corresponding to a network address
[Expand]
function gethostbyname(name: PChar): PHostEnt;
Description: Retrieve network address corresponding to a host name
[Expand]
function gethostname(name: PChar; namelen:tOS_INT):tOS_INT;
Description: Retrieve the standard host name for the local computer
[Expand]
function getservbyport(port:tOS_INT; proto: PChar):PServEnt;
Description: Retrieve service information corresponding to a port and protocol
[Expand]
function getservbyname(name, proto: PChar): PServEnt;
Description: Retrieve service information corresponding to a service name and protocol
[Expand]
function getprotobynumber(proto:tOS_INT):PProtoEnt;
Description: Retrieve protocol information corresponding to a protocol number
[Expand]
function getprotobyname(name: PChar): PProtoEnt;
Description: Retrieve the protocol information corresponding to a protocol name
[Expand]
function WSAStartup(wVersionRequired:word; var WSAData:TWSADATA):tOS_INT;
Description: Initiate use of Winsock by an application
[Expand]
procedure WSASetLastError(iError:tOS_INT); inline;
Description: Set the error code that can be retrieved through the WSAGetLastError function
[Expand]
function WSAGetLastError:tOS_INT; inline;
Description: Return the error status for the last Windows Sockets operation that failed
[Expand]
function WSASetBlockingHook(lpBlockFunc: TFarProc): TFarProc;
Description: To be documented
[Expand]
function WSAAsyncGetServByName(hWnd:HWND; wMsg:u_int; name:pchar; proto:pchar; buf:pchar; buflen:tOS_INT):THandle;
Description: To be documented
[Expand]
function WSAAsyncGetServByPort(hWnd:HWND; wMsg:u_int; port:tOS_INT; proto:pchar; buf:pchar; buflen:tOS_INT):THandle;
Description: To be documented
[Expand]
function WSAAsyncGetProtoByName(hWnd:HWND; wMsg:u_int; name:pchar; buf:pchar; buflen:tOS_INT):THandle;
Description: To be documented
[Expand]
function WSAAsyncGetProtoByNumber(hWnd:HWND; wMsg:u_int; number:tOS_INT; buf:pchar; buflen:tOS_INT):THandle;
Description: To be documented
[Expand]
function WSAAsyncGetHostByName(hWnd:HWND; wMsg:u_int; name:pchar; buf:pchar; buflen:tOS_INT):THandle;
Description: To be documented
[Expand]
function WSAAsyncGetHostByAddr(hWnd:HWND; wMsg:u_int; addr:pchar; len:tOS_INT; family:tOS_INT; buf:pchar; buflen:tOS_INT):THandle;
Description: To be documented
[Expand]
function WSACancelAsyncRequest(hAsyncTaskHandle:THandle):tOS_INT;
Description: To be documented
[Expand]
function WSAAsyncSelect(s: TSocket; hWnd:HWND; wMsg:u_int; lEvent:longint):tOS_INT;
Description: To be documented
[Expand]
function WSARecvEx(s: TSocket;var buf; len:tOS_INT; flags:ptOS_INT):tOS_INT;
Description: Receive data from a connected socket or a bound connectionless socket
[Expand]
function __WSAFDIsSet(s: TSocket; var FDSet:TFDSet):BOOL;
Description: Return a value indicating whether a socket is included in a set of socket descriptors
[Expand]
function __WSAFDIsSet_(s: TSocket; var FDSet:TFDSet):tOS_INT;
Description: Return a value indicating whether a socket is included in a set of socket descriptors
[Expand]
function TransmitFile(hSocket: TSocket; hFile: THandle; nNumberOfBytesToWrite: DWORD; nNumberOfBytesPerSend: DWORD; lpOverlapped: POverlapped; lpTransmitBuffers: PTransmitFileBuffers; dwReserved: DWORD): BOOL;
Description: To be documented
[Expand]
function AcceptEx(sListenSocket, sAcceptSocket: TSocket; lpOutputBuffer: Pointer; dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: DWORD; lpdwBytesReceived: LPDWORD; lpOverlapped: POverlapped): BOOL;
Description: To be documented
[Expand]
procedure GetAcceptExSockaddrs(lpOutputBuffer: Pointer; dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: DWORD; LocalSockaddr: PPSockAddr; LocalSockaddrLength: PInteger; RemoteSockaddr: PPSockAddr; RemoteSockaddrLength: PInteger);
Description: To be documented
[Expand]
procedure FD_CLR(Socket:TSocket; var FDSet:TFDSet);
Description: Remove a socket from an fd_set
[Expand]
function FD_ISSET(Socket:TSocket; var FDSet:TFDSet):Boolean;
Description: Check if a socket is a member of an fd_set
Winsock undocumented functions
[Expand]
function WsControl(Proto:DWORD; Action:DWORD; pRequestInfo:Pointer; var pcbRequestInfoLen:DWORD; pResponseInfo:Pointer; var pcbResponseInfoLen:DWORD):Integer;
Description: To be documented
[Expand]
function getnetbyaddr(addr: Pointer; len, Struct: Integer): PNetEnt;
Description: Retrieve the network information corresponding to a network address
[Expand]
function getnetbyname(name: PChar): PNetEnt;
Description: Retrieve network address corresponding to a network name
Winsock enhanced functions
[Expand]
function WsControlEx(Proto:DWORD; Action:DWORD; pRequestInfo:Pointer; var pcbRequestInfoLen:DWORD; pResponseInfo:Pointer; var pcbResponseInfoLen:DWORD):Integer;
Description: To be documented
RTL text IO functions
[Expand]
function SysTextIOReadChar(var ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for platform TextIOReadChar function
[Expand]
function SysTextIOWriteChar(ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for platform TextIOWriteChar function
[Expand]
function SysTextIOWriteBuffer(ABuffer:PChar; ACount:LongInt; AUserData:Pointer):LongInt;
Description: Handler for platform TextIOWriteBuffer function
Winsock helper functions
[Expand]
function WinsockRedirectInput(s:TSocket):Boolean;
Description: Redirect standard input to the socket specified by s
[Expand]
function WinsockRedirectOutput(s:TSocket):Boolean;
Description: Redirect standard output to the socket specified by s
Return to Unit Reference