procedure TForm1.IdTCPServer1Connect(AThread: TIdPeerThread);
type
  TCP_KeepAlive = record
    OnOff: Cardinal;
    KeepAliveTime: Cardinal;
    KeepAliveInterval: Cardinal
  end;
var
  Val: TCP_KeepAlive;
  Ret: DWord;
begin
  Val.OnOff:=1;
  Val.KeepAliveTime:=xxx;
  Val.KeepAliveInterval:=xxx;
  WSAIoctl(AThread.Connection.Socket.Binding.Handle, IOC_IN or IOC_VENDOR or 4,
    @Val, SizeOf(Val), nil, 0, @Ret, nil, nil)
end;  
posted on 2011-03-26 10:36  fyen  阅读(595)  评论(0编辑  收藏  举报