604
社区成员
发帖
与我相关
我的任务
分享
function AllowUdpConnReset(Sd:TSocket;bNewBehavior:BOOL):BOOL;
var
dwBytesReturned:DWORD ;
status:Integer;
dwErr:DWORD ;
begin
Result := False;
dwBytesReturned := 0;
// disable new behavior using
// IOCTL: SIO_UDP_CONNRESET
status := WSAIoctl( sd, SIO_UDP_CONNRESET,
@bNewBehavior, sizeof(bNewBehavior),
Nil, 0, @dwBytesReturned,
Nil, Nil);
if (SOCKET_ERROR = status) then
begin
dwErr := WSAGetLastError();
if (WSAEWOULDBLOCK = dwErr) then
begin
// nothing to do
Exit;
end
else
begin
Exit;
end;
end;
Result := True;
end;
BOOL AllowUdpConnReset(TSocket Sd, BOOL bNewBehavior)
{
DWORD dwBytesReturned ;
Integer status;
DWORD dwErr ;
dwBytesReturned = 0;
// disable new behavior using
// IOCTL: SIO_UDP_CONNRESET
status = WSAIoctl(Sd, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
if (SOCKET_ERROR == status)
{
DWORD dwErr = WSAGetLastError();
if (WSAEWOULDBLOCK == dwErr)
{
// nothing to do
return(FALSE);
}
else
{
return(FALSE);
}
}
}