cs1.6我知道主机的ip怎么连入 我在cs1.6控制台指令大全输入 connec...

&&&&&这篇文章记录了我刚接触IOCP模型时的理解,对于初学者,应该算不错的调试程序,仅有一个400多行代码的dpr文件,可以直接用WriteLn输出信息,前提是会用delphi建立Console Application,当然你也可以很容易的就改成了C控制台程序或是其它语言。附加代码中有详细的注释,如果你已有IOCP经验,那么请不用在此浪费时间,这个示例不适合你。示例仅展示了IOCP中AcceptEx, DisconnectEx, GetAcceptExSockaddr等的用法。在文章最后有推荐的两个连接,对于想深入研究IOCP与TCP的可以去看看,可人感觉值得去看。文中错误或是不合理的地方敬请原谅,如果方便还请指出,深表感谢!
&&&&刚接触IOCP时,因为要弄清里面的复杂关系,最直接的方法当然就是断点调试与信息输出了,所以我选用了控制台程序。具体的原理在文章末尾的第一个连接中讲得很详细,扩展的方法可以到MSDN上查。示例中仅用了一个工作线程和10个连接,个人觉得这样方便调试与查看输出信息,省去了多线程与数据池的干扰,当然在实际应用中会涉及线程池、消息队列、内存管理等等,不在这个示例展示范围。下面我只记录了我碰到的问题:
&&&&问题一:AcceptEx成功,但有客户端连接时,GetQueuedCompletionStatus却不返回,后来把ListenSocket用CreateIoCompletionPort绑定到完在端口之后问题不再出现,因为之前用WSAAccept,就没有把ListenSocket绑定。
&&&&问题二:10014错误,在一开始时,gOverls用了array[0..ACCEPT_COUNT - 1] of TIOCPRecord,用这样的类型时,AcceptEx是成功的,也能接收几个连接,但是测试的连接不完全能连上,后来改用array[0..ACCEPT_COUNT - 1] of PIOCPRecord,用New分配内存时,测试连接能全部连上,分析原因,可能是栈内存与堆内存的区别。另外一次出现10014是把TWSABUF中的u_long类型改为int64类型后出现这个错。
&&&&问题三:首次GetQueuedCompletionStatus的完键不是预期的那个,即soAccept时的那个完成键并不是想要的那个,连接后正常。我一开始AcceptEx时就已经把每一个待接收的Socket绑定到了完成端口,因为连接非法时不想在DisconnectEx那里判断。
&&&&问题四:要说一下TAcceptEx与TGetAcceptExSockaddrs中的dwReceiveDataLength参数,这个初始值如果不是0,那么当IOCP接到一个连接时并不立即返回,而是收到客户端的数据时才返回。这会导致DOS攻击的大量连接耗尽预设等待的Socket连接,即AcceptEx投递的连接资源,如果设置为0,那么有连接时GetQueuedCompletionStatus就回立即返回,至于是否非法那就仁者见人智者见智了,比如心跳包的检测。使用AcceptEx时,一定要保证IOCP中有空闲的Socket接收客户端。
&&&&问题五:ERROR_IO_PENDING(997),当WSAGetLastError返回这个值时表示已经进入处理中,但并没有处理完。
&&& 问题六:GetQueuedCompletionStatus返回soWrite状态时,buffer的数据不一写就发送完了,没有发送完的数据继续WSASend。
&&&&下图是我写完这个示例后对IOCP中那几个API关系的理解,注意图中的箭头方向,PostQueuedCompletionStatus,AcceptEx,WSARecv, WSASend, DisconnectEx都是向IOCP内部投递数据,投递完后立即返回,这并不意味着投递的数据就会立即被处理,可以理解为进入一个等待处理队列,这几个方法可以投递多个数据不阻塞。PostQueuedCompletionStatus一般用于结束工作线程时使用,也就是GetQueuedCompletionStatus会得到PostQueuedCompletionStatus的状态信息。所有IOCP内部处理完的数据都会通过GetQueuedCompletionStatus这个方法反回,比如收到客户端请求后,发送数据到客户端后。这是一个阻塞的方法,当然可以设置超时。每一个工作线程也就通过GetQueuedCompletionStatus这个方法来处理消息,具体可以看后面的附加代码。
附加IOCPsever.dpr与WinSock2.pas:
1 program IOCPS
3 {$APPTYPE CONSOLE}
WinSock2 in 'winsock2.pas';
WINSOCK_VERSION = $0202;
LISTEN_PORT = 6553;
//***端口
MAX_BUFFSIZE = 4096;
//数据buffer
ACCEPT_COUNT = 10;
//接收连接数
SHUTDOWN_FLAG = $FFFFFFFF;
//退出标记
SO_UPDATE_ACCEPT_CONTEXT = $700B;
TF_REUSE_SOCKET
IOC_VENDOR
SIO_KEEPALIVE_VALS
=IOC_IN or IOC_VENDOR or 4;
WSAID_GETACCEPTEXSOCKADDRS: System.TGuid = (D1:$b:$D3:$11D4:($95,$ca,$00,$80,$5f,$48,$a1,$92));
WSAID_ACCEPTEX: System.TGuid = (D1:$b:$D3:$11D4:($95,$ca,$00,$80,$5f,$48,$a1,$92));
WSAID_CONNECTEX: System.TGuid = (D1:$25a207b9;D2:$ddf3;D3:$4660;D4:($8e,$e9,$76,$e5,$8c,$74,$06,$3e));
WSAID_DISCONNECTEX: System.TGuid = (D1:$7fda2e11;D2:$8630;D3:$436f;D4:($a0,$31,$f5,$36,$a6,$ee,$c1,$57));
TAcceptEx = function(sListenSocket, sAcceptSocket: TS
lpOutputBuffer: P dwReceiveDataLength, dwLocalAddressLength,
dwRemoteAddressLength: LongW var lpdwBytesReceived: LongW
lpOverlapped: POverlapped): BOOL; stdcall;
TGetAcceptExSockaddrs = procedure(lpOutputBuffer: P
dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: DWORD;
var LocalSockaddr: PSockA var LocalSockaddrLength: I
var RemoteSockaddr: PSockA var RemoteSockaddrLength: Integer);stdcall;
TConnectEx = function(const s : TS const name: PSOCKADDR; const
namelen: I lpSendBuffer : P dwSendDataLength : DWORD; var
lpdwBytesSent : LongW lpOverlapped : POverlapped): BOOL; stdcall;
TDisconnectEx = function(const hSocket : TS lpOverlapped: PO
const dwFlags : LongW const dwReserved : LongWord) : BOOL; stdcall;
PTCPKeepAlive = ^TTCPKeepA
TTCPKeepAlive = packed record
KeepInterval:
TSockOperate = (soAccept, soDisconnect, soRead, soWrite);
PIOCPRecord = ^TIOCPR
TIOCPRecord = packed record
Ovelpd: TO
WsaBuf: TWsaB
Buffer: array [0..MAX_BUFFSIZE - 1] of AnsiC
operate: TSockO
gListen: TS
gOverls: array[0..ACCEPT_COUNT - 1] of PIOCPR
gIOCP: THandle = 0;
gWorker: TH
gFunAcceptEx: TAcceptEx = nil;
gFunGetAcceptEx: TGetAcceptExSockaddrs = nil;
gFunConnectEx: TConnectEx = nil;
gFunDisconnectEx: TDisconnectEx = nil;
73 //加载扩展函数
74 function LoadFunEx(ASock: TSocket): B
tag: LongW
Result := F
if ASock = INVALID_SOCKET then E
if SOCKET_ERROR = WSAIoctl(ASock, SIO_GET_EXTENSION_FUNCTION_POINTER,
@WSAID_ACCEPTEX, SizeOf(WSAID_ACCEPTEX),
@@gFunAcceptEx, SizeOf(Pointer), @tag, nil, nil)then
gFunAcceptEx := nil;
if SOCKET_ERROR = WSAIoctl(ASock, SIO_GET_EXTENSION_FUNCTION_POINTER,
@WSAID_GETACCEPTEXSOCKADDRS, SizeOf(WSAID_GETACCEPTEXSOCKADDRS),
@@gFunGetAcceptEx, SizeOf(Pointer), @tag, nil, nil)then
gFunGetAcceptEx := nil;
if SOCKET_ERROR = WSAIoctl(ASock, SIO_GET_EXTENSION_FUNCTION_POINTER,
@WSAID_CONNECTEX,
SizeOf(WSAID_CONNECTEX),
@@gFunConnectEx,
SizeOf(Pointer), @tag, nil,
gFunConnectEx := nil;
if SOCKET_ERROR = WSAIoctl(ASock, SIO_GET_EXTENSION_FUNCTION_POINTER,
@WSAID_DISCONNECTEX,
SizeOf(WSAID_DISCONNECTEX),
@@gFunDisconnectEx,
SizeOf(Pointer), @tag, nil,
gFunDisconnectEx := nil;
Result := T
119 //判断socket是否有效
120 function IsSocketAlive(ASock: TSocket): B
tmp: LongW
Result := WinSock2.send(ASock, tmp, 0, 0) && -1;
127 //设置心跳
128 procedure SetKeepLive(ASock: TSocket);
dwFlags: DWORD;
inKeepAlive, OutKeepAlive: TTCPKeepA
if ASock && INVALID_SOCKET then
inKeepAlive.KeepOn := 1;
inKeepAlive.KeepTime := 5000;
inKeepAlive.KeepInterval := 1;
if (SetSockOpt(ASock, SOL_SOCKET, SO_KEEPALIVE, @opt, SizeOf(opt)) = SOCKET_ERROR)
or (WSAIoctl(ASock, SIO_KEEPALIVE_VALS, @inKeepAlive,SizeOf(TTCPKeepAlive),
@outKeepAlive, SizeOf(TTCPKeepAlive), @dwFlags, nil, nil) = SOCKET_ERROR) then
WriteLn('设置心跳错误 socket: ' + Inttostr(ASock) + 'Error: ' + Inttostr(WSAGetLastError) );
148 //关闭socket
149 procedure FunCloseSocket(ASock: TSocket);
Linger: TL
if ASock && INVALID_SOCKET then
FillChar(Linger, SizeOf(TLinger), 0);
setsockopt(ASock, SOL_SOCKET, SO_LINGER, @Linger, Sizeof(Linger));
closesocket(ASock);
161 procedure ResetData(PData: PIOCPRecord);
if Assigned(PData) then
sock := PData.
FillChar(PData^, SizeOf(TIOCPRecord), 0);
PData^.WsaBuf.len := MAX_BUFFSIZE;
PData^.WsaBuf.buf := @(PData^.Buffer[0]);
PData.sock :=
175 //投递一个接收socket
176 function PostAccept(PAccept: PIOCPRecord): B
dwBytes: LongW
Result := F
if Assigned(PAccept) and (PAccept^.sock && INVALID_SOCKET)
ResetData(PAccept);
PAccept^.operate := soA
dwBytes := 0;
Result := gFunAcceptEx(gListen, PAccept^.sock, PAccept^.Wsabuf.buf, 0,
SizeOf(TSockAddrIn) + 16, SizeOf(TSockAddrIn) + 16,
dwBytes, @(PAccept^.Ovelpd))
or (ERROR_IO_PENDING = WSAGetLastError);
193 //投递一个断开socket
194 function PostDisconnect(PData: PIOCPRecord): B
Result := F
if Assigned(PData) and (PData^.sock && INVALID_SOCKET)
ResetData(PData);
PData^.operate := soD
WinSock2.shutdown(PData^.sock, SD_BOTH);
Result := gFunDisconnectEx(PData^.sock, @(PData^.Ovelpd), TF_REUSE_SOCKET, 0)
or (ERROR_IO_PENDING = WSAGetLastError);
if Result then
WriteLn('客户端断开:socket ' + Inttostr(PData^.sock))
WriteLn('客户端断开错误:socket ' + Inttostr(PData^.sock) + ' WSAError: ' + Inttostr(WSAGetLastError));
211 //投递接收数据缓冲
212 function PostRecv(PData: PIOCPRecord): B
dwBuff, dwRecv: LongW
Result := F
if Assigned(PData) and (PData^.sock && INVALID_SOCKET)
ResetData(PData);
PData^.operate := soR
dwBuff := 0;
dwRecv := 0;
Result := (WSARecv(PData^.sock, @(PData^.WsaBuf), 1, @dwBuff, @dwRecv, @(PData^.Ovelpd), nil) && SOCKET_ERROR)
or (ERROR_IO_PENDING = WSAGetLastError);
228 procedure WriteError(AInfo: String);
WriteLn(AInfo + ' WSAError: ' + Inttostr(WSAGetLastError));
233 //工作线程
234 function WorkProc(PValue: Pointer): Istdcall;
data: PIOCPR
workCount, dwSend, dwFlags: C
str: AnsiS
remoteAddr, localAddr: PSockA
remoteLen, localLen, opt: I
Result := 0;
while true do
data := nil;
workCount := 0;
sock := 0;
if not GetQueuedCompletionStatus(gIOCP, workCount, Cardinal(sock), POVerlapped(data), INFINITE) then
begin //有可能是***端断开
if Assigned(data) then
PostDisconnect(data);
WriteLn('Worker GetQueued socket:' + inttostr(sock));
if Cardinal(data) = SHUTDOWN_FLAG then B // 有退出
if not Assigned(data) then continue;
case data^.operate of
gFunGetAcceptEx(Data^.WsaBuf.buf, 0, SizeOf(TSockAddrIn) + 16, SizeOf(TSockAddrIn) + 16,
PSockAddr(localAddr), localLen, PSockAddr(remoteAddr), remoteLen);
WriteLn('接入IP: ' + inet_ntoa(remoteAddr^.sin_addr) + ' Port: ' + Inttostr(ntohs(remoteAddr^.sin_port)));
SetSockOpt(data^.sock, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, PAnsiChar(@(gListen)), SizeOf(gListen));
SetKeepLive(data^.sock);
if PostRecv(data) then
WriteLn('Accept 数据 socket: ' + Inttostr(data^.sock))
WriteError('Accept 错误 socket: ' + inttostr(data^.sock));
soDisconnect:
if PostAccept(data) then
WriteLn('投递Acceptex socket: ' + Inttostr(data^.sock))
WriteError('Disconnectex投递错误 socket: ' + Inttostr(data^.sock));
if workCount = 0 then
PostDisconnect(data)
else begin
data^.WsaBuf.len := data^.WsaBuf.len - workC
if data^.WsaBuf.len &= 0 then
WriteLn('服务器回复数据完成 socket: ' + inttostr(data^.sock));
PostRecv(data);
dwSend := 0;
dwFlags := 0;
FillChar(data^.Ovelpd, Sizeof(data^.Ovelpd), 0);
if (WSASend(data^.sock, @(data^.WsaBuf), 1, @dwSend, dwFlags, @data^.Ovelpd, nil)&&SOCKET_ERROR)
or (ERROR_IO_PENDING = WSAGetLastError) then
WriteLn('发送数据 socket: ' + Inttostr(data^.sock))
else begin
WriteError('发送数据错误 socket: ' + Inttostr(data^.sock));
if dwSend = SOCKET_ERROR then//客户端断开
PostDisconnect(data)
if workCount = 0 then
PostDisconnect(data)
else begin
sock := data^.
SetLength(str, workCount);
Move(data^.Buffer[0], str[1], workCount);
WriteLn('接收数据 socket: ' + Inttostr(sock) + ' str: ' + str);
str := '服务器回复:' +
dwSend := 0;
dwFlags := 0;
FillChar(data^, SizeOf(TIOCPRecord), 0);
data^.WsaBuf.len := Length(str);
data^.WsaBuf.buf := @(data^.Buffer[0]);
data^.operate := soW
data^.sock :=
Move(str[1], data^.Buffer[0], data^.WsaBuf.len);
if not ( (WSASend(sock, @(data^.WsaBuf), 1, @dwSend, dwFlags, @(data^.Ovelpd), nil) && SOCKET_ERROR)
or (WSAGetlastError =
ERROR_IO_PENDING) ) then
WriteLn('服务器回复数据失败 socket: ' + Inttostr(sock));
PostRecv(data);
WriteLn('服务器回复数据 socket: ' + Inttostr(sock));
end; // end of case
end;// end of while
threadID: C
WSData: TWSAD
addr: TSockA
console: array[0..255] of AnsiC
label exitL
WriteLn('初始化网络环境');
if WSAStartup(WINSOCK_VERSION, WSData) && 0 then goto exitL
WriteLn('创建完成端口');
gIOCP := CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0);
if gIOCP = 0 then
goto exitL
WriteLn('创建***Socket');
gListen := WSASocket(PF_INET, SOCK_STREAM, 0, nil, 0, WSA_FLAG_OVERLAPPED);
if gListen = INVALID_SOCKET then goto exitL
WriteLn('加载扩展函数');
if not LoadFunEx(gListen) then goto exitL
WriteLn('邦定***Socket 与IOCP ['
+ inttostr(gListen) + '][' + inttostr(gIOCP) + ']');
if CreateIoCompletionPort(gListen, gIOCP, gListen, 0) = 0 then goto exitL
WriteLn('邦定***Socket 与IP');
FillChar(Addr, SizeOf(TSockAddrIn), 0);
Addr.sin_family := AF_INET;
Addr.sin_port := htons(LISTEN_PORT);
Addr.sin_addr.S_addr := htonl(INADDR_ANY);
//Addr.sin_addr.S_addr := inet_addr('0.0.0.0');
if WinSock2.bind(gListen, @Addr, SizeOf(TSockAddr)) && 0 then goto exitL
WriteLn('开始***Socket');
if WinSock2.listen(gListen, SOMAXCONN) && 0 then goto exitL
WriteLn('投递接收Socket');
FillChar(gOverls[0], SizeOf(gOverls), 0);
for i := 0 to ACCEPT_COUNT - 1 do
New(gOverls[i]);
gOverls[i]^.sock := WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, nil, 0, WSA_FLAG_OVERLAPPED);
if gOverls[i]^.sock = INVALID_SOCKET then goto exitL
if CreateIoCompletionPort(gOverls[i]^.sock, gIOCP, gOverls[i]^.sock, 0) = 0 then goto exitL
if PostAccept(gOverls[i]) then
WriteLn('投递Socket:' + Inttostr(gOverls[i]^.sock))
else goto exitL
//处理完端口请求
WriteLn('创建工作线程 ');
gWorker := BeginThread(nil, 0, @WorkProc, nil, 0, threadID);
if gWorker = 0 then goto exitL
WriteLn('键入exit退出 ');
while True do
ReadLn(console);
if console = 'exit' then
console := '';
WriteLn('投递完成端口结束标记, 退出工作线程');
if not PostQueuedCompletionStatus(gIOCP, 0, 0, Pointer(SHUTDOWN_FLAG)) then
WriteLn('投递完成端口结束标记错误:' + inttostr(GetLastError));
TerminateThread(gWorker, 0);
WriteLn('关闭工作线程句柄');
CloseHandle(gWorker);
WriteLn('释放socket资源');
for i := 0 to ACCEPT_COUNT - 1 do
Dispose(gOverls[i]);
FillChar(gOverls[0], SizeOf(gOverls), 0);
WriteLn('关闭***端口');
FunCloseSocket(gListen);
WriteLn('关闭完成端口');
CloseHandle(gIOCP);
WriteLn('释放网络环境');
exitLabel:
if need then
WriteLn('运行错误:' + Inttostr(WSAGetLastError));
on e:Exception do
WriteLn(e.Message);
IOCPServer.dpr
1 {*******************************************************}
Windows Sockets API v. 2.20 Header File
Prerelease 16.09.96
WinSock2.h from Winsock SDK 1.6 BETA
Delphi 2 RTL Windows32 API Interface
(c) 1996 by Artur Grajek 'AHS'
email: c51725ag@juggernaut.eti.pg.gda.pl
13 {*******************************************************}
14 {$MINENUMSIZE 4} { Force 4 bytes enumeration size}
16 unit WinSock2;
18 interface
u_char = C
u_short = W
u_long = L
pu_long = ^u_
pu_short = ^u_
30 { The new type to be used in all
instances which refer to sockets. }
TSocket = u_
FD_SETSIZE
PFDSet = ^TFDS
TFDSet = packed record
fd_count: u_
fd_array: array[0..FD_SETSIZE-1] of TS
PTimeVal = ^TTimeV
TTimeVal = packed record
tv_usec: L
IOCPARM_MASK = $7f;
= (IOC_IN or IOC_OUT);
= IOC_OUT or { get # bytes to read }
((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or
(Longint(Byte('f')) shl 8) or 127;
= IOC_IN or { set/clear non-blocking i/o }
((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or
(Longint(Byte('f')) shl 8) or 126;
= IOC_IN or { set/clear async i/o }
((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or
(Longint(Byte('f')) shl 8) or 125;
70 { Protocols }
IPPROTO_IP
IPPROTO_ICMP
{ Internet Control Message Protocol }
IPPROTO_IGMP
{ Internet Group Management Protocol}
IPPROTO_GGP
IPPROTO_TCP
IPPROTO_PUP
IPPROTO_UDP
{ User Datagram Protocol
IPPROTO_IDP
IPPROTO_ND
{ UNOFFICIAL Net Disk Protocol
IPPROTO_RAW
IPPROTO_MAX
85 { Port/socket numbers: network standard functions}
IPPORT_ECHO
IPPORT_DISCARD =
IPPORT_SYSTAT
IPPORT_DAYTIME =
IPPORT_NETSTAT =
IPPORT_FTP
IPPORT_TELNET
IPPORT_SMTP
IPPORT_TIMESERVER
IPPORT_NAMESERVER
IPPORT_WHOIS
IPPORT_MTP
100 { Port/socket numbers: host specific functions }
IPPORT_TFTP
IPPORT_RJE
IPPORT_FINGER
IPPORT_TTYLINK
IPPORT_SUPDUP
108 { UNIX TCP sockets }
IPPORT_EXECSERVER
IPPORT_LOGINSERVER =
IPPORT_CMDSERVER
IPPORT_EFSSERVER
115 { UNIX UDP sockets }
IPPORT_BIFFUDP
IPPORT_WHOSERVER
IPPORT_ROUTESERVER =
121 { Ports & IPPORT_RESERVED are reserved for
privileged processes (e.g. root). }
IPPORT_RESERVED
126 { Link numbers }
IMPLINK_IP
IMPLINK_LOWEXPER
IMPLINK_HIGHEXPER
SunB = packed record
s_b1, s_b2, s_b3, s_b4: u_
SunW = packed record
s_w1, s_w2: u_
PInAddr = ^TInA
TInAddr = packed record
case integer of
0: (S_un_b: SunB);
1: (S_un_w: SunW);
2: (S_addr: u_long);
PSockAddrIn = ^TSockAddrIn;
TSockAddrIn = packed record
case Integer of
0: (sin_family: u_
sin_port: u_
sin_addr: TInA
sin_zero: array[0..7] of Char);
1: (sa_family: u_
sa_data: array[0..13] of Char)
PHostEnt = ^THostE
THostEnt = packed record
h_name: PC
h_aliases: ^PC
h_addrtype: S
h_length: S
case integer of
0: (h_addr_list: ^PChar);
1: (h_addr: ^PInAddr);
PNetEnt = ^TNetE
TNetEnt = packed record
n_name: PC
n_aliases: ^PC
n_addrtype: S
PServEnt = ^TServE
TServEnt = packed record
s_name: PC
s_aliases: ^PC
s_proto: PC
PProtoEnt = ^TProtoE
TProtoEnt = packed record
p_name: PC
p_aliases: ^P
p_proto: S
INADDR_ANY
INADDR_LOOPBACK
= $7F000001;
INADDR_BROADCAST = $FFFFFFFF;
INADDR_NONE
= $FFFFFFFF;
= INADDR_ANY;
WSADESCRIPTION_LEN
WSASYS_STATUS_LEN
PWSAData = ^TWSAD
TWSAData = packed record
wVersion: W
wHighVersion: W
szDescription: array[0..WSADESCRIPTION_LEN] of C
szSystemStatus: array[0..WSASYS_STATUS_LEN] of C
iMaxSockets: W
iMaxUdpDg: W
lpVendorInfo: PC
PTransmitFileBuffers = ^TTransmitFileB
TTransmitFileBuffers = packed record
HeadLength: DWORD;
TailLength: DWORD;
228 { Options for use with [gs]etsockopt at the IP level. }
IP_OPTIONS
IP_MULTICAST_IF
{ set/get IP multicast interface
IP_MULTICAST_TTL
{ set/get IP multicast timetolive
IP_MULTICAST_LOOP
{ set/get IP multicast loopback
IP_ADD_MEMBERSHIP
an IP group membership
IP_DROP_MEMBERSHIP
{ drop an IP group membership
IP_DEFAULT_MULTICAST_TTL
{ normally limit m'casts to 1 hop
IP_DEFAULT_MULTICAST_LOOP
{ normally hear sends if a member
IP_MAX_MEMBERSHIPS
{ must fit in one mbuf }
241 { This is used instead of -1, since the
TSocket type is unsigned.}
INVALID_SOCKET
= TSocket(NOT(0));
SOCKET_ERROR
be used in place of the address family, socket type, or
to WSASocket to indicate that the corresponding value
be taken from the supplied WSAPROTOCOL_INFO structure instead of the
parameter itself.
FROM_PROTOCOL_INFO
255 { Types }
SOCK_STREAM
{ stream socket }
SOCK_DGRAM
{ datagram socket }
{ raw-protocol interface }
{ reliably-delivered message }
SOCK_SEQPACKET
{ sequenced packet stream }
263 { Option flags per-socket. }
{ turn on debugging info recording }
SO_ACCEPTCONN
{ socket has had listen() }
SO_REUSEADDR
{ allow local address reuse }
SO_KEEPALIVE
{ keep connections alive }
SO_DO***OUTE
{ just use interface addresses }
SO_BROADCAST
{ permit sending of broadcast msgs }
SO_USELOOPBACK
{ bypass hardware when possible }
{ linger on close if data present }
SO_OOBINLINE
{ leave received OOB data in line }
SO_DONTLINGER
277 { Additional options. }
{ send buffer size }
{ receive buffer size }
SO_SNDLOWAT
{ send low-water mark }
SO_RCVLOWAT
{ receive low-water mark }
SO_SNDTIMEO
{ send timeout }
SO_RCVTIMEO
{ receive timeout }
{ get error status and clear }
{ get socket type }
288 { Options for connect and disconnect data and options.
Used only by
non-TCP/IP transports such as DECNet, OSI TP4, etc. }
SO_CONNDATA
SO_CONNOPT
SO_DISCDATA
SO_DISCOPT
SO_CONNDATALEN
SO_CONNOPTLEN
SO_DISCDATALEN
SO_DISCOPTLEN
300 { WinSock 2 extension -- new options }
SO_GROUP_ID
= $2001; { ID of a socket group}
SO_GROUP_PRIORITY = $2002; { the relative priority within a group}
SO_MAX_MSG_SIZE
= $2003; { maximum message size }
SO_PROTOCOL_INFOA = $2004; { WSAPROTOCOL_INFOA structure }
SO_PROTOCOL_INFOW = $2005; { WSAPROTOCOL_INFOW structure }
308 {$IFDEF UNICODE }
SO_PROTOCOL_INFO
= SO_PROTOCOL_INFOW;
310 {$ELSE }
SO_PROTOCOL_INFO
= SO_PROTOCOL_INFOA;
312 {$ENDIF UNICODE }
PVD_CONFIG
= $3001; {configuration info for service provider }
315 { Option for opening sockets for synchronous access. }
SO_OPENTYPE
SO_SYNCHRONOUS_ALERT
SO_SYNCHRONOUS_NONALERT = $20;
322 { Other NT-specific options. }
SO_MAXPATHDG
327 { TCP options. }
TCP_NODELAY
TCP_BSDURGENT
332 { Address families. }
{ unspecified }
{ local to host (pipes, portals) }
{ internetwork: UDP, TCP, etc. }
AF_IMPLINK
{ arpanet imp addresses }
{ pup protocols: e.g. BSP }
{ mit CHAOS protocols }
{ IPX and SPX }
{ XEROX NS protocols }
{ ISO protocols }
{ OSI is ISO }
{ european computer manufacturers }
AF_DATAKIT
{ datakit protocols }
{ CCITT protocols, X.25 etc }
{ IBM SNA }
{ DECnet }
{ Direct data link interface }
{ NSC Hyperchannel }
AF_APPLETALK
{ AppleTalk }
AF_NETBIOS
{ NetBios-style addresses }
AF_VOICEVIEW
{ VoiceView }
AF_FIREFOX
{ FireFox }
AF_UNKNOWN1
{ Somebody is using this! }
{ Banyan }
{ Native ATM Services }
{ Internetwork Version 6 }
{ Structure used by kernel to store most addresses. }
PSockAddr = ^TSockA
TSockAddr = TSockAddrIn;
{ Structure used by kernel to pass protocol information in raw sockets. }
PSockProto = ^TSockP
TSockProto = packed record
sp_family: u_
sp_protocol: u_
377 { Protocol families, same as address families for now. }
= AF_UNSPEC;
= AF_UNIX;
= AF_INET;
PF_IMPLINK
= AF_IMPLINK;
= AF_CHAOS;
= AF_ECMA;
PF_DATAKIT
= AF_DATAKIT;
= AF_CCITT;
= AF_HYLINK;
PF_APPLETALK
= AF_APPLETALK;
PF_VOICEVIEW
= AF_VOICEVIEW;
PF_FIREFOX
= AF_FIREFOX;
PF_UNKNOWN1
= AF_UNKNOWN1;
= AF_INET6;
408 { Structure used for manipulating linger option. }
PLinger = ^TL
TLinger = packed record
l_onoff: u_
l_linger: u_
416 { Level number for (get/set)sockopt() to apply to socket itself. }
SOL_SOCKET
{options for socket level }
420 { Maximum queue length specifiable by listen. }
{ AHS - by? 5 !?????? }
{process out-of-band data }
{peek at incoming message }
MSG_DO***OUTE
{send without using routing tables }
MSG_MAXIOVLEN
MSG_PARTIAL
{partial send or recv for message xport }
432 { WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and
WSARecvFrom() }
MSG_INTERRUPT
{send/recv in the interrupt context}
437 { Define constant based on rfc883, used by gethostbyxxxx() calls. }
MAXGETHOSTSTRUCT
441 { Define flags to be used with the WSAAsyncSelect() call. }
FD_CONNECT
FD_GROUP_QOS
FD_MAX_EVENTS
FD_ALL_EVENTS
= $100; { AHS - trudno powiedzie? ile powinno by?}
454 { All Windows Sockets error constants are biased by WSABASEERR from the "normal" }
WSABASEERR
458 { Windows Sockets definitions of regular Microsoft C error constants }
= (WSABASEERR+4);
= (WSABASEERR+9);
= (WSABASEERR+13);
= (WSABASEERR+14);
= (WSABASEERR+22);
= (WSABASEERR+24);
467 { 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);
WSAEADDRNOT***AIL
= (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);
= (WSABASEERR+62);
WSAENAMETOOLONG
= (WSABASEERR+63);
WSAEHOSTDOWN
= (WSABASEERR+64);
WSAEHOSTUNREACH
= (WSABASEERR+65);
WSAENOTEMPTY
= (WSABASEERR+66);
WSAEPROCLIM
= (WSABASEERR+67);
= (WSABASEERR+68);
= (WSABASEERR+69);
= (WSABASEERR+70);
WSAEREMOTE
= (WSABASEERR+71);
507 { Extended Windows Sockets error constant definitions }
WSASYSNOTREADY
= (WSABASEERR+91);
WS***ERNOTSUPPORTED
= (WSABASEERR+92);
WSANOTINITIALISED
= (WSABASEERR+93);
WSAEDISCON
= (WSABASEERR+101);
WSAENOMORE
= (WSABASEERR+102);
WSAECANCELLED
= (WSABASEERR+103);
WSAEEINVALIDPROCTABLE
= (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);
525 { 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. }
534 { Authoritative Answer: Host not found }
WSAHOST_NOT_FOUND
= (WSABASEERR+1001);
HOST_NOT_FOUND
= WSAHOST_NOT_FOUND;
539 { Non-Authoritative: Host not found, or SERVERFAIL }
WSATRY_AGAIN
= (WSABASEERR+1002);
= WSATRY_AGAIN;
544 { Non recoverable errors, FORMERR, REFUSED, NOTIMP }
WSANO_RECOVERY
= (WSABASEERR+1003);
NO_RECOVERY
= WSANO_RECOVERY;
549 { Valid name, no data record of requested type }
WSANO_DATA
= (WSABASEERR+1004);
= WSANO_DATA;
554 { no address, look for MX record }
WSANO_ADDRESS
= WSANO_DATA;
NO_ADDRESS
= WSANO_ADDRESS;
559 { 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;
WSAEALREADY;
WSAENOTSOCK;
EDESTADDRREQ
WSAEDESTADDRREQ;
WSAEMSGSIZE;
EPROTOTYPE
WSAEPROTOTYPE;
ENOPROTOOPT
WSAENOPROTOOPT;
EPROTONOSUPPORT
WSAEPROTONOSUPPORT;
ESOCKTNOSUPPORT
WSAESOCKTNOSUPPORT;
EOPNOTSUPP
WSAEOPNOTSUPP;
EPFNOSUPPORT
WSAEPFNOSUPPORT;
EAFNOSUPPORT
WSAEAFNOSUPPORT;
EADDRINUSE
WSAEADDRINUSE;
EADDRNOT***AIL
WSAEADDRNOT***AIL;
WSAENETDOWN;
ENETUNREACH
WSAENETUNREACH;
WSAENETRESET;
ECONNABORTED
WSAECONNABORTED;
ECONNRESET
WSAECONNRESET;
WSAENOBUFS;
WSAEISCONN;
WSAENOTCONN;
WSAESHUTDOWN;
ETOOMANYREFS
WSAETOOMANYREFS;
WSAETIMEDOUT;
ECONNREFUSED
WSAECONNREFUSED;
ENAMETOOLONG
WSAENAMETOOLONG;
WSAEHOSTDOWN;
EHOSTUNREACH
WSAEHOSTUNREACH;
WSAENOTEMPTY;
WSAEPROCLIM;
WSAEUSERS;
WSAEDQUOT;
WSAESTALE;
WSAEREMOTE;
601 { AHS }
602 { WinSock 2 extension -- new error codes and type definition }
= THANDLE;
= PHANDLE;
LPWSAEVENT
= LPHANDLE;
WSAOVERLAPPED
= TOVERLAPPED;
LPWSAOVERLAPPED
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
= DWORD($FFFFFFFF); { ahs }
WSA_WAIT_EVENT_0
= WAIT_OBJECT_0;
WSA_WAIT_IO_COMPLETION
= WAIT_IO_COMPLETION;
WSA_WAIT_TIMEOUT
= WAIT_TIMEOUT;
WSA_INFINITE
= INFINITE;
629 { WinSock 2 extension -- WSABUF and QOS struct }
633 PWSABUF = ^TWSABUF;
634 TWSABUF = packed record
{ the length of the buffer }
{ the pointer to the buffer }
639 GUARANTEE = (
BestEffortService,
ControlledLoadService,
PredictiveService,
GuaranteedDelayService,
GuaranteedService
647 PFlowspec = ^TF
648 TFlowspec = packed record
{ In Bytes/sec }
TokenBucketSize
{ In Bytes }
PeakBandwidth
{ In Bytes/sec }
{ In microseconds }
DelayVariation
{ In microseconds }
LevelOfGuarantee
{ Guaranteed, Predictive }
{ or Best Effort
CostOfCall
{ Reserved for future use, }
{ must be set to 0 now
NetworkAvailability
{ read-only:
1 if accessible, }
663 PQOS = ^TQualityOfS
664 TQualityOfService = packed record
SendingFlowspec
{ the flow spec for data sending }
ReceivingFlowspec
{ the flow spec for data receiving }
ProviderSpecific
{ additional provider specific stuff }
672 { WinSock 2 extension -- manifest constants for return values of the
condition function}
679 {WinSock 2 extension -- manifest constants for shutdown() }
SD_RECEIVE
685 { WinSock 2 extension -- data type and manifest constants for socket groups }
SG_UNCONSTRAINED_GROUP
SG_CONSTRAINED_GROUP
696 { WinSock 2 extension -- data type for WSAEnumNetworkEvents() }
700 PWSANETWORKEVENTS = ^TWSANETWORKEVENTS;
701 TWSANETWORKEVENTS = packed record
lNetworkEvents
iErrorCode
: array [0..FD_MAX_EVENTS-1] of u_
706 {WinSock 2 extension -- WSAPROTOCOL_INFO structure and associated
manifest constants}
709 PGUID = ^TGUID;
710 TGUID = packed record
: array [0..8-1] of u_
MAX_PROTOCOL_CHAIN
BASE_PROTOCOL
LAYERED_PROTOCOL
726 PWSAPROTOCOLCHAIN = ^TWSAPROTOCOLCHAIN;
727 TWSAPROTOCOLCHAIN = packed record
{ the length of the chain,
{ length = 0 means layered protocol, }
{ length = 1 means base protocol, }
{ length & 1 means protocol chain }
ChainEntries : array[0..MAX_PROTOCOL_CHAIN-1] of DWORD; { a list of dwCatalogEntryIds }
WSAPROTOCOL_LEN
741 PWSAPROTOCOL_INFOA = ^TWSAPROTOCOL_INFOA;
742 TWSAPROTOCOL_INFOA = packed record
dwServiceFlags1
dwServiceFlags2
dwServiceFlags3
dwServiceFlags4
dwProviderFlags
ProviderId
dwCatalogEntryId
ProtocolChain
: TWSAPROTOCOLCHAIN;
iAddressFamily
iMaxSockAddr
iMinSockAddr
iSocketType
iProtocolMaxOffset
iNetworkByteOrder
iSecurityScheme
dwMessageSize
dwProviderReserved
szProtocol
: array [0..WSAPROTOCOL_LEN+1-1] of u_
765 PWSAPROTOCOL_INFOW = ^TWSAPROTOCOL_INFOW;
766 TWSAPROTOCOL_INFOW = packed record
dwServiceFlags1
dwServiceFlags2
dwServiceFlags3
dwServiceFlags4
dwProviderFlags
ProviderId
dwCatalogEntryId
ProtocolChain
: TWSAPROTOCOLCHAIN;
iAddressFamily
iMaxSockAddr
iMinSockAddr
iSocketType
iProtocolMaxOffset
iNetworkByteOrder
iSecurityScheme
dwMessageSize
dwProviderReserved
szProtocol
: array [0..WSAPROTOCOL_LEN+1-1] of WCHAR;
789 {$ifdef UNICODE}
791 TWSAPROTOCOL_INFO
= TWSAPROTOCOL_INFOW ;
792 PWSAPROTOCOL_INFO =
PWSAPROTOCOL_INFOW ;
794 {$else}
796 TWSAPROTOCOL_INFO
= TWSAPROTOCOL_INFOA ;
797 PWSAPROTOCOL_INFO =
PWSAPROTOCOL_INFOA ;
799 {$endif UNICODE}
802 { Flag bit definitions for dwProviderFlags }
PFL_MULTIPLE_PROTO_E***IES
PFL_RECOMMENDED_PROTO_E***Y
PFL_HIDDEN
PFL_MATCHES_PROTOCOL_ZERO
809 { Flag bit definitions for dwServiceFlags1 }
XP1_CONNECTIONLESS
XP1_GUARANTEED_DELIVERY
XP1_GUARANTEED_ORDER
XP1_MESSAGE_ORIENTED
XP1_PSEUDO_STREAM
XP1_GRACEFUL_CLOSE
XP1_EXPEDITED_DATA
XP1_CONNECT_DATA
XP1_DISCONNECT_DATA
XP1_SUPPORT_BROADCAST
XP1_SUPPORT_MULTIPOINT
XP1_MULTIPOINT_CO***OL_PLANE
XP1_MULTIPOINT_DATA_PLANE
XP1_QOS_SUPPORTED
XP1_INTERRUPT
XP1_UNI_SEND
XP1_UNI_RECV
XP1_IFS_HANDLES
XP1_PARTIAL_MESSAGE
LITTLEENDIAN
SECURITY_PROTOCOL_NONE
835 { WinSock 2 extension -- manifest constants for WSAJoinLeaf() }
JL_SENDER_ONLY
JL_RECEIVER_ONLY
841 { WinSock 2 extension -- manifest constants for WSASocket() }
WSA_FLAG_OVERLAPPED
WSA_FLAG_MULTIPOINT_C_ROOT
WSA_FLAG_MULTIPOINT_C_LEAF
WSA_FLAG_MULTIPOINT_D_ROOT
WSA_FLAG_MULTIPOINT_D_LEAF
849 { WinSock 2 extension -- manifest constants for WSAIoctl() }
IOC_PROTOCOL
IOC_VENDOR
SIO_ASSOCIATE_HANDLE
= IOC_IN or IOC_WS2 or 1;
SIO_ENABLE_CIRCULAR_QUEUEING
= IOC_VOID or IOC_WS2 or 2;
SIO_FIND_ROUTE
= IOC_OUT or IOC_WS2 or 3;
= IOC_VOID or IOC_WS2 or 4;
SIO_GET_BROADCAST_ADDRESS
= IOC_OUT or IOC_WS2 or 5;
SIO_GET_EXTENSION_FUNCTION_POINTER
= IOC_INOUT or IOC_WS2 or 6;
SIO_GET_QOS
= IOC_INOUT or IOC_WS2 or 7;
SIO_GET_GROUP_QOS
= IOC_INOUT or IOC_WS2 or 8;
SIO_MULTIPOINT_LOOPBACK
= IOC_IN or IOC_WS2 or 9;
SIO_MULTICAST_SCOPE
= IOC_IN or IOC_WS2 or 10;
SIO_SET_QOS
= IOC_IN or IOC_WS2 or 11;
SIO_SET_GROUP_QOS
= IOC_IN or IOC_WS2 or 12;
SIO_TRANSLATE_HANDLE
= IOC_INOUT or IOC_WS2 or 13;
870 { WinSock 2 extension -- manifest constants for SIO_TRANSLATE_HANDLE ioctl }
Microsoft Windows Extended data types required for the functions to
addresses. }
= TSockA { AHS ?}
LPSOCKADDR
885 { Manifest constants and type definitions related to name resolution and
registration (RNR) API }
888 PBLOB = ^TBLOB;
889 TBLOB = packed record
pBlobData :^
894 { Service Install Flags }
SERVICE_MULTIPLE
900 { Name Spaces }
NS_PEER_BROWSE
NS_TCPIP_LOCAL
NS_TCPIP_HOSTS
NS_NISPLUS
Resolution flags for WSAGetAddressByName().
Note these are also used by the 1.1 API GetAddressByName, so
leave them around. }
RES_UNUSED_1
RES_FLUSH_CACHE
RES_SERVICE
936 { Well known value names for Service Types }
SERVICE_TYPE_VALUE_IPXPORTA
='IpxSocket';
SERVICE_TYPE_VALUE_IPXPORTW
= 'IpxSocket';
SERVICE_TYPE_VALUE_SAPIDA
= 'SapId';
SERVICE_TYPE_VALUE_SAPIDW
SERVICE_TYPE_VALUE_TCPPORTA
= 'TcpPort';
SERVICE_TYPE_VALUE_TCPPORTW
='TcpPort';
SERVICE_TYPE_VALUE_UDPPORTA
= 'UdpPort';
SERVICE_TYPE_VALUE_UDPPORTW
='UdpPort';
SERVICE_TYPE_VALUE_OBJECTIDA
= 'ObjectId';
SERVICE_TYPE_VALUE_OBJECTIDW
='ObjectId';
952 {$ifdef UNICODE}
SERVICE_TYPE_VALUE_SAPID
=SERVICE_TYPE_VALUE_SAPIDW;
SERVICE_TYPE_VALUE_TCPPORT
=SERVICE_TYPE_VALUE_TCPPORTW;
SERVICE_TYPE_VALUE_UDPPORT
=SERVICE_TYPE_VALUE_UDPPORTW;
SERVICE_TYPE_VALUE_OBJECTID
=SERVICE_TYPE_VALUE_OBJECTIDW;
959 {$else} { not UNICODE }
SERVICE_TYPE_VALUE_SAPID
=SERVICE_TYPE_VALUE_SAPIDA;
SERVICE_TYPE_VALUE_TCPPORT
=SERVICE_TYPE_VALUE_TCPPORTA;
SERVICE_TYPE_VALUE_UDPPORT
=SERVICE_TYPE_VALUE_UDPPORTA;
SERVICE_TYPE_VALUE_OBJECTID
=SERVICE_TYPE_VALUE_OBJECTIDA;
966 {$endif}
968 { SockAddr Information }
971 PSOCKET_ADDRESS = ^TSOCKET_ADDRESS;
972 TSOCKET_ADDRESS = packed record
lpSockaddr
PSOCKADDR ;
iSockaddrLength
977 { CSAddr Information }
979 PCSADDR_INFO = ^TCSADDR_INFO;
980 TCSADDR_INFO = packed record
:TSOCKET_ADDRESS;
RemoteAddr
:TSOCKET_ADDRESS;
iSocketType
988 { Address Family/Protocol Tuples }
990 PAFPROTOCOLS = ^TAFPROTOCOLS;
991 TAFPROTOCOLS = packed record
iAddressFamily
996 { Client Query API Typedefs }
998 { The comparators }
1000 PWSAEcomparator = ^TWSAE
1001 TWSAEcomparator = (
COMP_EQUAL,
COMP_NOTLESS
1006 PWS***ersion = ^TWS***
1007 TWS***ersion = packed record
1012 PWSAQuerySetA = ^TWSAQuerySetA;
1013 TWSAQuerySetA = packed record
lpszServiceInstanceName : PC
lpServiceClassId
: PWS***ERSION;
lpszComment
dwNameSpace
lpNSProviderId
lpszContext
dwNumberOfProtocols
lpafpProtocols
: PAFPROTOCOLS;
lpszQueryString
dwNumberOfCsAddrs
lpcsaBuffer
: PCSADDR_INFO;
dwOutputFlags
1031 PWSAQuerySetW = ^TWSAQuerySetW;
1032 TWSAQuerySetW = packed record
lpszServiceInstanceName : PWideC
//MIO, antes WideChar
lpServiceClassId
: PWS***ERSION;
lpszComment
//MIO, antes WideChar
dwNameSpace
lpNSProviderId
lpszContext
//MIO, antes WideChar
dwNumberOfProtocols
lpafpProtocols
: PAFPROTOCOLS;
lpszQueryString
//MIO, antes WideChar
dwNumberOfCsAddrs
lpcsaBuffer
: PCSADDR_INFO;
dwOutputFlags
1050 {$ifdef UNICODE}
WSAQUERYSET
= TWSAQUERYSETW;
PWSAQUERYSET
= PWSAQUERYSETW;
1055 {$else}
WSAQUERYSET
= TWSAQUERYSETA;
PWSAQUERYSET
= PWSAQUERYSETA;
1060 {$endif }
1062 const
LUP_CONTAINERS
LUP_NOCONTAINERS
LUP_NEAREST
LUP_RETURN_NAME
LUP_RETURN_TYPE
LUP_RETURN_VERSION
LUP_RETURN_COMMENT
LUP_RETURN_ADDR
LUP_RETURN_BLOB
LUP_RETURN_ALIASES
LUP_RETURN_QUERY_STRING = $0800;
LUP_RETURN_ALL
LUP_RES_SERVICE
LUP_FLUSHCACHE
LUP_FLUSHPREVIOUS
1083 { Return flags }
RESULT_IS_ALIAS
1087 { Service Address Registration and Deregistration Data Types. }
1091 PWSAESETSERVICEOP = ^TWSAESETSERVICEOP;
1092 TWSAESETSERVICEOP = (
RNRSERVICE_REGISTER,
RNRSERVICE_DEREGISTER,
RNRSERVICE_DELETE
1098 { Service Installation/Removal Data Types. }
1100 PWSANSClassInfoA = ^TWSANSClassInfoA;
1101 TWSANSClassInfoA = packed record
dwNameSpace
dwValueType
dwValueSize
1109 PWSANSClassInfoW = ^TWSANSClassInfoW;
1110 TWSANSClassInfoW = packed record
dwNameSpace
dwValueType
dwValueSize
1118 {$ifdef UNICODE }
TWSANSCLASSINFO
= TWSANSCLASSINFOW;
PWSANSCLASSINFO
= PWSANSCLASSINFOW;
1123 {$else}
TWSANSCLASSINFO
= TWSANSCLASSINFOA;
PWSANSCLASSINFO
= PWSANSCLASSINFOA;
1128 {$endif
1130 PWSAServiceClassInfoA = ^TWSAServiceClassInfoA;
1131 TWSAServiceClassInfoA = packed record
lpServiceClassId
lpszServiceClassName
lpClassInfos
: PWSANSCLASSINFOA;
1138 PWSAServiceClassInfoW = ^TWSAServiceClassInfoW;
1139 TWSAServiceClassInfoW = packed record
lpServiceClassId
lpszServiceClassName
lpClassInfos
: PWSANSCLASSINFOW;
1146 {$ifdef UNICODE}
TWSASERVICECLASSINFO
= TWSASERVICECLASSINFOW;
PWSASERVICECLASSINFO
= PWSASERVICECLASSINFOW;
1151 {$else}
TWSASERVICECLASSINFO
= TWSASERVICECLASSINFOA;
PWSASERVICECLASSINFO
= PWSASERVICECLASSINFOA;
1156 {$endif
1158 PWSANAMESPACE_INFOA = ^TWSANAMESPACE_INFOA;
1159 TWSANAMESPACE_INFOA = packed record
NSProviderId
dwNameSpace
lpszIdentifier
1167 PWSANAMESPACE_INFOW = ^TWSANAMESPACE_INFOW;
1168 TWSANAMESPACE_INFOW = packed record
NSProviderId
dwNameSpace
lpszIdentifier
1176 {$ifdef UNICODE}
TWSANAMESPACE_INFO
= TWSANAMESPACE_INFOW;
PWSANAMESPACE_INFO
= PWSANAMESPACE_INFOW;
1181 {$else}
TWSANAMESPACE_INFO
= TWSANAMESPACE_INFOA;
PWSANAMESPACE_INFO
= PWSANAMESPACE_INFOA;
1186 {$endif
1188 { AHS END }
1190 { Socket function prototypes }
1192 // Using "var addr:TSockAddr" in accept makes impossible to compile for IPv6
1193 function accept(s: TS addr: PSockA var addrlen: Integer): TS stdcall;
1194 // Using "var addr:TSockAddr" in bind makes impossible to compile for IPv6
1195 function bind(s: TS addr: PSockA namelen: Integer): I stdcall;
1196 function closesocket(s: TSocket): I stdcall;
1197 // Using "var addr:TSockAddr" in connect makes impossible to compile for IPv6
1198 function connect(s: TS name: PSockA namelen: Integer): I stdcall;
1199 function ioctlsocket(s: TS cmd: L var arg: u_long): I stdcall;
1200 function getpeername(s: TS var name: TSockA var namelen: Integer): I stdcall;
1201 // Using "var addr:TSockAddr" in getsockname makes impossible to compile for IPv6
1202 function getsockname(s: TS name: PSockA var namelen: Integer): I stdcall;
1203 function getsockopt(s: TS level, optname: I optval: PC var optlen: Integer): I stdcall;
1204 function htonl(hostlong: u_long): u_ stdcall;
1205 function htons(hostshort: u_short): u_ stdcall;
1206 function inet_addr(cp: PChar): u_ stdcall; {PInA}
{ TInAddr }
1207 function inet_ntoa(inaddr: TInAddr): PC stdcall;
1208 function listen(s: TS backlog: Integer): I stdcall;
1209 function ntohl(netlong: u_long): u_ stdcall;
1210 function ntohs(netshort: u_short): u_ stdcall;
1211 function recv(s: TS var B len, flags: Integer): I stdcall;
1212 // Using "var from: TSockAddr" in recvfrom makes impossible to compile for IPv6
1213 function recvfrom(s: TS var B len, flags: I
from: PSockA var fromlen: Integer): I stdcall;
1215 function select(nfds: I readfds, writefds, exceptfds: PFDS
timeout: PTimeVal): L stdcall;
1217 function send(s: TS var B len, flags: Integer): I stdcall;
1218 // Using "var addrto: TSockAddr" in sendto makes impossible to compile for IPv6
1219 function sendto(s: TS var B len, flags: I addrto: PSockA
tolen: Integer): I stdcall;
1221 function setsockopt(s: TS level, optname: I optval: PC
optlen: Integer): I stdcall;
1223 function shutdown(s: TS how: Integer): I stdcall;
1224 function socket(af, struct, protocol: Integer): TS stdcall;
1225 function gethostbyaddr(addr: P len, struct: Integer): PHostE stdcall;
1226 function gethostbyname(name: PChar): PHostE stdcall;
1227 function gethostname(name: PC len: Integer): I stdcall;
1228 function getservbyport(port: I proto: PChar): PServE stdcall;
1229 function getservbyname(name, proto: PChar): PServE stdcall;
1230 function getprotobynumber(proto: Integer): PProtoE stdcall;
1231 function getprotobyname(name: PChar): PProtoE stdcall;
1232 function WSAStartup(wVersionRequired: var WSData: TWSAData): I stdcall;
1233 function WSACleanup: I stdcall;
1234 procedure WSASetLastError(iError: Integer); stdcall;
1235 function WSAGetLastError: I stdcall;
1236 function WSAIsBlocking: BOOL; stdcall;
1237 function WSAUnhookBlockingHook: I stdcall;
1238 function WSASetBlockingHook(lpBlockFunc: TFarProc): TFarP stdcall;
1239 function WSACancelBlockingCall: I stdcall;
1240 function WSAAsyncGetServByName(HWindow: HWND; wMsg: u_
name, proto, buf: PC buflen: Integer): TH stdcall;
1242 function WSAAsyncGetServByPort( HWindow: HWND; wMsg, port: u_
proto, buf: PC buflen: Integer): TH stdcall;
1244 function WSAAsyncGetProtoByName(HWindow: HWND; wMsg: u_
name, buf: PC buflen: Integer): TH stdcall;
1246 function WSAAsyncGetProtoByNumber(HWindow: HWND; wMsg: u_ number: I
buf: PC buflen: Integer): TH stdcall;
1248 function WSAAsyncGetHostByName(HWindow: HWND; wMsg: u_
name, buf: PC buflen: Integer): TH stdcall;
1250 function WSAAsyncGetHostByAddr(HWindow: HWND; wMsg: u_ addr: PC
len, struct: I buf: PC buflen: Integer): TH stdcall;
1252 function WSACancelAsyncRequest(hAsyncTaskHandle: THandle): I stdcall;
1253 function WSAAsyncSelect(s: TS HWindow: HWND; wMsg: u_ lEvent: Longint): I stdcall;
1255 { WinSock 2 extensions -- data types for the condition function in
WSAAccept() and overlapped I/O completion routine. }
1260 PCONDITIONPROC = function ( lpCallerId:PWSABUF; lpCallerData:PWSABUF;
lpSQOS:PQOS; lpGQOS:PQOS; lpCalleeId:PWSABUF;lpCalleeData:PWSABUF;
g:PG dwCallbackData:DWord) :u_ stdcall;
1264 PWSAOVERLAPPED_COMPLETION_ROUTINE = procedure ( dwError :D
cbTransferred: DWORD; lpOverlapped: LPWSAOVERLAPPED; dwFlags: Dword
); stdcall;
1268 { WinSock 2 API new function prototypes }
1270 function WSAAccept( s: TSOCKET; addr: addrlen: PINT;
lpfnCondition: PCONDITIONPROC; dwCallbackData: DWORD): TSOCKET; stdcall;
1272 function WSACloseEvent( hEvent: WSAEVENT ):BOOL; stdcall;
1273 function WSAConnect(s: TSOCKET; name:namelen: u_
lpCallerData: PWSABUF; lpCalleeData: PWSABUF; lpSQOS: PQOS;
lpGQOS: PQOS) : u_ stdcall;
1276 function WSACreateEvent:WSAEVENT; stdcall;
1278 {$IFDEF UNICODE}
1279 function WSADuplicateSocket(s: TS dwProcessId: DWORD;
lpProtocolInfo: PWSAPROTOCOL_INFOW): u_ stdcall;
1281 {$ELSE}
1282 function WSADuplicateSocket(s: TS dwProcessId: DWORD;
lpProtocolInfo: PWSAPROTOCOL_INFOA): u_ stdcall;
1284 {$ENDIF} {UNICODE}
1286 function WSAEnumNetworkEvents( s: TS hEventObject: WSAEVENT;
lpNetworkEvents: PWSANETWORKEVENTS): u_ stdcall;
1289 {$IFDEF UNICODE}
1290 function WSAEnumProtocols( lpiProtocols: PI
lpProtocolBuffer: PWSAPROTOCOL_INFOW; lpdwBufferLength: PDWORD
): u_ stdcall;
1293 {$ELSE}
1294 function WSAEnumProtocols( lpiProtocols: PI
lpProtocolBuffer: PWSAPROTOCOL_INFOA; lpdwBufferLength: PDWORD
): u_ stdcall;
1297 {$ENDIF} {UNICODE}
1299 function WSAEventSelect(s: TSOCKET; hEventObject: WSAEVENT;
lNetworkEvents: u_long): u_ stdcall;
1301 function WSAGetOverlappedResult( s: TS lpOverlapped: LPWSAOVERLAPPED;
lpcbTransfer: PDWORD; fWait: BOOL; lpdwFlags: PDWORD): BOOL; stdcall;
1303 function WSAGetQOSByName( s: TS lpQOSName: PWSABUF;
lpQOS: PQOS): BOOL; stdcall;
1305 function WSAHtonl( s: TS hostlong: u_ lpnetlong: pu_long)
: u_ stdcall;
1307 function WSAHtons( s: TS hostshort: u_ lpnetshort: pu_short)
: u_ stdcall;
1309 function WSAIoctl( s: TS dwIoControlCode: DWORD; lpvInBuffer: P
cbInBuffer: DWORD; lpvOutBuffer: P cbOutBuffer: DWORD;
lpcbBytesReturned: PDWORD; lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: PWSAOVERLAPPED_COMPLETION_ROUTINE): u_ stdcall;
1313 function WSAJoinLeaf( s: TS name: namelen: u_
lpCallerData: PWSABUF; lpCalleeData: PWSABUF; lpSQOS: PQOS; lpGQOS: PQOS;
dwFlags: DWORD): TS stdcall;
1316 function WSANtohl( s: TS netlong: u_ lphostlong: pu_long)
: u_ stdcall;
1318 function WSANtohs( s: TS netshort: u_ lphostshort: pu_short)
: u_ stdcall;
1320 function WSARecv( s: TS lpBuffers: PWSABUF; dwBufferCount: DWORD;
lpNumberOfBytesRecvd: PDWORD; lpFlags: PDWORD;lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: PWSAOVERLAPPED_COMPLETION_ROUTINE): u_ stdcall;
1323 function WSARecvDisconnect( s: TS lpInboundDisconnectData: PWSABUF)
: u_ stdcall;
1325 function WSARecvFrom( s: TS lpBuffers: PWSABUF; dwBufferCount: DWORD;
lpNumberOfBytesRecvd: PDWORD; lpFlags: PDWORD; lpFrom:
lpFromlen: PI lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: PWSAOVERLAPPED_COMPLETION_ROUTINE): u_ stdcall;
1329 function WSAResetEvent( hEvent: WSAEVENT): BOOL; stdcall;
1330 function WSASend( s: TS lpBuffers: PWSABUF; dwBufferCount: DWORD;
lpNumberOfBytesSent: PDWORD; dwFlags: DWORD; lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: PWSAOVERLAPPED_COMPLETION_ROUTINE): u_ stdcall;
1333 function WSASendDisconnect( s: TS lpOutboundDisconnectData: PWSABUF)
: u_ stdcall;
1335 function WSASendTo(s: TS lpBuffers: PWSABUF; dwBufferCount: DWORD;
lpNumberOfBytesSent: PDWORD;dwFlags: DWORD; lpTo: iTolen: u_
lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: PWSAOVERLAPPED_COMPLETION_ROUTINE): u_ stdcall;
1339 function WSASetEvent( hEvent: WSAEVENT): BOOL; stdcall;
1340 {$IFDEF UNICODE}
1341 function WSASocket( af: u_ atype: u_ protocol: u_
lpProtocolInfo: PWSAPROTOCOL_INFOW; g: TG dwFlags: Dword)
: TS stdcall;
1344 {$ELSE}
1345 function WSASocket( af: u_ atype: u_ protocol: u_
lpProtocolInfo: PWSAPROTOCOL_INFOA; g: TG dwFlags: Dword)
: TS stdcall;
1348 {$ENDIF} { UNICODE}
1349 function WSAWaitForMultipleEvents( cEvents: DWORD; lphEvents: LPWSAEVENT;
fWaitAll: BOOL; dwTimeout: DWORD; fAlertable: BOOL): DWORD; stdcall;
1351 {$IFDEF UNICODE}
1352 function WSAAddressToString( lpsaAddress: PSOCKADDR; dwAddressLength: DWORD;
lpProtocolInfo: PWSAPROTOCOL_INFOW; lpszAddressString: WideC
lpdwAddressStringLength: PDWORD): u_ stdcall;
1355 {$ELSE}
1356 function WSAAddressToString( lpsaAddress: PSOCKADDR; dwAddressLength: DWORD;
lpProtocolInfo: PWSAPROTOCOL_INFOA; lpszAddressString: PC
lpdwAddressStringLength: PDWORD): u_ stdcall;
1359 {$ENDIF} { UNICODE}
1361 {$IFDEF UNICODE}
1362 function WSAStringToAddress( AddressString: WideC AddressFamily: u_
lpProtocolInfo: PWSAPROTOCOL_INFOW; lpAddress: PSOCKADDR;
lpAddressLength: PInt): u_ stdcall;
1365 {$ELSE}
1366 function WSAStringToAddress( AddressString: PC AddressFamily: u_
lpProtocolInfo: PWSAPROTOCOL_INFOA; lpAddress: PSOCKADDR;
lpAddressLength: PInt): u_ stdcall;
1369 {$ENDIF} { UNICODE}
1371 { Registration and Name Resolution API functions }
1373 {$IFDEF UNICODE}
1374 function WSALookupServiceBegin( lpqsRestrictions: PWSAQUERYSETW;
dwControlFlags: DWORD; lphLookup: LPHANDLE): u_ stdcall;
1376 {$ELSE}
1377 function WSALookupServiceBegin( lpqsRestrictions: PWSAQUERYSETA;
dwControlFlags: DWORD; lphLookup: LPHANDLE): u_ stdcall;
1379 {$ENDIF} { UNICODE}
1381 {$IFDEF UNICODE}
1382 function WSALookupServiceNext( hLookup: THANDLE; dwControlFlags: DWORD;
lpdwBufferLength: PDWORD; lpqsResults: PWSAQUERYSETW): u_ stdcall;
1384 {$ELSE}
1385 function WSALookupServiceNext( hLookup: THANDLE; dwControlFlags: DWORD;
lpdwBufferLength: PDWORD; lpqsResults: PWSAQUERYSETA): LongI stdcall;
1387 {$ENDIF} { UNICODE}
1389 function WSALookupServiceEnd( hLookup: THandle): u_ stdcall;
1391 {$IFDEF UNICODE}
1392 function WSAInstallServiceClass( lpServiceClassInfo: PWSASERVICECLASSINFOW
): u_ stdcall;
1394 {$ELSE}
1395 function WSAInstallServiceClass( lpServiceClassInfo: PWSASERVICECLASSINFOA
): u_ stdcall;
1397 {$ENDIF} { UNICODE}
1399 function WSARemoveServiceClass(lpServiceClassId: PGUID): u_ stdcall;
1401 {$IFDEF UNICODE}
1402 function WSAGetServiceClassInfo( lpProviderId: PGUID; lpServiceClassId: PGUID;
lpdwBufSize: PDWORD; lpServiceClassInfo: PWSASERVICECLASSINFOW)
: u_ stdcall;
1405 {$ELSE}
1406 function WSAGetServiceClassInfo( lpProviderId: PGUID; lpServiceClassId: PGUID;
lpdwBufSize: PDWORD; lpServiceClassInfo: PWSASERVICECLASSINFOA)
: u_ stdcall;
1409 {$ENDIF} { UNICODE}
1411 {$IFDEF UNICODE}
1412 function WSAEnumNameSpaceProviders( lpdwBufferLength: PDWORD;
lpnspBuffer: PWSANAMESPACE_INFOW):u_ stdcall;
1414 {$ELSE}
1415 function WSAEnumNameSpaceProviders( lpdwBufferLength: PDWORD;
lpnspBuffer: PWSANAMESPACE_INFOA):u_ stdcall;
1417 {$ENDIF} { UNICODE}
1419 {$IFDEF UNICODE}
1420 function WSAGetServiceClassNameByClassId( lpServiceClassId: PGUID;
lpszServiceClassName: WideC lpdwBufferLength: PDWORD): u_ stdcall;
1422 {$ELSE}
1423 function WSAGetServiceClassNameByClassId( lpServiceClassId: PGUID;
lpszServiceClassName: PC lpdwBufferLength: PDWORD): u_ stdcall;
1425 {$ENDIF} { UNICODE}
1427 {$IFDEF UNICODE}
1428 function WSASetService( lpqsRegInfo: PWSAQUERYSETW;
essoperation: TWSAESETSERVICEOP; dwControlFlags: DWORD):u_ stdcall;
1430 {$ELSE}
1431 function WSASetService( lpqsRegInfo: PWSAQUERYSETA;
essoperation: TWSAESETSERVICEOP; dwControlFlags: DWORD):u_ stdcall;
1433 {$ENDIF} { UNICODE}
1435 function WSARecvEx(s: TS var len: I var flags: Integer): I stdcall;
1437 function TransmitFile(hSocket: TS hFile: TH nNumberOfBytesToWrite: DWORD;
nNumberOfBytesPerSend: DWORD; lpOverlapped: PO
lpTransmitBuffers: PTransmitFileB dwReserved: DWORD): BOOL; stdcall;
1441 function WSAMakeASyncReply(Buflen, Error: Word): L
1442 function WSAMakeSelectReply(Event, Error: Word): L
1443 function WSAGetAsyncBuflen(Param: Longint): W
1444 function WSAGetAsyncError(Param: Longint): W
1445 function WSAGetSelectEvent(Param: Longint): W
1446 function WSAGetSelectError(Param: Longint): W
1448 implementation
1450 const
winsocket = 'ws2_32.dll';
1453 function WSAMakeASyncR
1454 begin
WSAMakeASyncReply:= MakeLong(Buflen, Error);
1458 function WSAMakeSelectR
1459 begin
WSAMakeSelectReply:= MakeLong(Event, Error);
1463 function WSAGetAsyncB
1464 begin
WSAGetAsyncBuflen:= LOWORD(Param);
1468 function WSAGetAsyncE
1469 begin
WSAGetAsyncError:= HIWORD(Param);
1473 function WSAGetSelectE
1474 begin
WSAGetSelectEvent:= LOWORD(Param);
1478 function WSAGetSelectE
1479 begin
WSAGetSelectError:= HIWORD(Param);
1483 function
winsocket name 'accept';
1485 function
winsocket name 'bind';
1487 function
winsocket name 'closesocket';
1489 function
winsocket name 'connect';
1491 function
winsocket name 'getpeername';
1493 function
winsocket name 'getsockname';
1495 function
winsocket name 'getsockopt';
1497 function
winsocket name 'htonl';
1499 function
winsocket name 'htons';
1501 function inet_
winsocket name 'inet_addr';
1503 function inet_
winsocket name 'inet_ntoa';
1505 function
winsocket name 'ioctlsocket';
1507 function
winsocket name 'listen';
1509 function
winsocket name 'ntohl';
1511 function
winsocket name 'ntohs';
1513 function
winsocket name 'recv';
1515 function
winsocket name 'recvfrom';
1517 function
winsocket name 'select';
1519 function
winsocket name 'send';
1521 function
winsocket name 'sendto';
1523 function
winsocket name 'setsockopt';
1525 function
winsocket name 'shutdown';
1527 function
winsocket name 'socket';
1530 function
winsocket name 'gethostbyaddr';
1532 function
winsocket name 'gethostbyname';
1534 function
winsocket name 'getprotobyname';
1536 function
winsocket name 'getprotobynumber';
1538 function
winsocket name 'getservbyname';
1540 function
winsocket name 'getservbyport';
1542 function
winsocket name 'gethostname';
1545 function WSAAsyncS
winsocket name 'WSAAsyncSelect';
1547 function WSARecvEx;
winsocket name 'WSARecvEx';
1549 function WSAAsyncGetHostByA
external winsocket name 'WSAAsyncGetHostByAddr';
1551 function WSAAsyncGetHostByN
external winsocket name 'WSAAsyncGetHostByName';
1553 function WSAAsyncGetProtoByN
external winsocket name 'WSAAsyncGetProtoByNumber';
1555 function WSAAsyncGetprotoByN
external winsocket name 'WSAAsyncGetprotoByName';
1557 function WSAAsyncGetServByP
external winsocket name 'WSAAsyncGetServByPort';
1559 function WSAAsyncGetServByN
external winsocket name 'WSAAsyncGetServByName';
1561 function WSACancelAsyncR
external winsocket name 'WSACancelAsyncRequest';
1563 function WSASetBlockingH
winsocket name 'WSASetBlockingHook';
1565 function WSAUnhookBlockingH
external winsocket name 'WSAUnhookBlockingHook';
1567 function WSAGetLastE
winsocket name 'WSAGetLastError';
1569 procedure WSASetLastE
winsocket name 'WSASetLastError';
1571 function WSACancelBlockingC
external winsocket name 'WSACancelBlockingCall';
1573 function WSAIsB
winsocket name 'WSAIsBlocking';
1575 function WSAS
winsocket name 'WSAStartup';
1577 function WSAC
winsocket name 'WSACleanup';
1580 {$IFDEF UNICODE}
1581 function WSASetS
winsocket name 'WSASetServiceW';
1583 function WSAGetServiceClassNameByClassId;
winsocket name 'WSAGetServiceClassNameByClassIdW';
1585 function WSAEnumNameSpaceP
winsocket name 'WSAEnumNameSpaceProvidersW';
1587 function WSAGetServiceClassI
winsocket name 'WSAGetServiceClassInfoW';
1589 function WSAInstallServiceC
winsocket name 'WSAInstallServiceClassW';
1591 function WSALookupServiceN
winsocket name 'WSALookupServiceNextW';
1593 function WSALookupServiceB
winsocket name 'WSALookupServiceBeginW';
1595 function WSAStringToA
winsocket name 'WSAStringToAddressW';
1597 function WSAAddressToS
winsocket name 'WSAAddressToStringW';
1599 function WSAS
winsocket name 'WSASocketW';
1601 function WSAEnumP
winsocket name 'WSAEnumProtocolsW';
1603 function WSADuplicateS
winsocket name 'WSADuplicateSocketW';
1605 {$ELSE}
1606 function WSASetS
winsocket name 'WSASetServiceA';
1608 function WSAGetServiceClassNameByClassId;
winsocket name 'WSAGetServiceClassNameByClassIdA';
1610 function WSAEnumNameSpaceP
winsocket name 'WSAEnumNameSpaceProvidersA';
1612 function WSAGetServiceClassI
winsocket name 'WSAGetServiceClassInfoA';
1614 function WSAInstallServiceC
winsocket name 'WSAInstallServiceClassA';
1616 function WSALookupServiceN
winsocket name 'WSALookupServiceNextA';
1618 function WSALookupServiceB
winsocket name 'WSALookupServiceBeginA';
1620 function WSAStringToA
winsocket name 'WSAStringToAddressA';
1622 function WSAAddressToS
winsocket name 'WSAAddressToStringA';
1624 function WSAS
winsocket name 'WSASocketA';
1626 function WSAEnumP
winsocket name 'WSAEnumProtocolsA';
1628 function WSADuplicateS
winsocket name 'WSADuplicateSocketA';
1630 {$ENDIF} { UNICODE}
1633 function WSALookupServiceE
winsocket name 'WSALookupServiceEnd';
1635 function WSARemoveServiceC
winsocket name 'WSARemoveServiceClass';
1637 function WSAWaitForMultipleE
winsocket name 'WSAWaitForMultipleEvents';
1639 function WSASetE
winsocket name 'WSASetEvent';
1641 function WSASendTo;
winsocket name 'WSASendTo';
1643 function WSASendD
winsocket name 'WSASendDisconnect';
1645 function WSAS
winsocket name 'WSASend';
1647 function WSAResetE
winsocket name 'WSAResetEvent';
1649 function WSARecvF
winsocket name 'WSARecvFrom';
1651 function WSARecvD
winsocket name 'WSARecvDisconnect';
1653 function WSAR
winsocket name 'WSARecv';
1655 function WSAI
winsocket name 'WSAIoctl';
1657 function WSAJoinL
winsocket name 'WSAJoinLeaf';
1659 function WSAN
winsocket name 'WSANtohl';
1661 function WSAN
winsocket name 'WSANtohs';
1663 function WSAH
winsocket name 'WSAHtons';
1665 function WSAH
winsocket name 'WSAHtonl';
1667 function WSAGetQOSByN
winsocket name 'WSAGetQOSByName';
1669 function WSAGetOverlappedR
winsocket name 'WSAGetOverlappedResult';
1671 function WSAEventS
winsocket name 'WSAEventSelect';
1673 function WSAEnumNetworkE
winsocket name 'WSAEnumNetworkEvents';
1675 function WSACreateE
winsocket name 'WSACreateEvent';
1677 function WSAC
winsocket name 'WSAConnect';
1679 function WSACloseE
winsocket name 'WSACloseEvent';
1681 function WSAA
winsocket name 'WSAAccept';
1684 function TransmitF
winsocket name 'TransmitFile';
winsock2.pas
&参考资料:
&&&&& 【完成端口详解】http://blog.csdn.net/piggyxp/article/details/6922277
&&&&& 【TCP的那些事】/articles/11564.html
以上就介绍了IOCP扩展方法AcceptEx, DisconnectEx, GetAcceptExSockaddr用法示例,包括了方面的内容,希望对Delphi教程有兴趣的朋友有所帮助。
本文网址链接:/article/detail_103311.html
上一篇: 下一篇:

参考资料

 

随机推荐