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;