首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

Delphi中SIO_UDP_CONNRESET如何定义

2013-08-01 
Delphi中SIO_UDP_CONNRESET怎么定义?用IdUDPServer想修正返回10054错误,从僵哥那抄来了Delphi版解决代码,

Delphi中SIO_UDP_CONNRESET怎么定义?
用IdUDPServer想修正返回10054错误,从僵哥那抄来了Delphi版解决代码,不过不知道在Delphi中SIO_UDP_CONNRESET怎么定义,请大神指点迷津!
微软解决方案中定义#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
http://support.microsoft.com/kb/263823
附代码(来自僵哥)
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;
[解决办法]
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)

翻译为:
const
  SIO_UDP_CONNRESET = $80000000 or $18000000 or 1;

热点排行