# HG changeset patch # User Ivo Smits # Date 1371072021 -7200 # Node ID 8df7f4dc56158826c0382387c20f4dc20b532984 # Parent 5a2b51b0d71b76d61800336f9f4d3904d8544be0 HTTP Server: enable KeepAlive option on TCP sockets diff -r 5a2b51b0d71b -r 8df7f4dc5615 Net/HTTP.cs --- a/Net/HTTP.cs Wed Jun 12 23:08:48 2013 +0200 +++ b/Net/HTTP.cs Wed Jun 12 23:20:21 2013 +0200 @@ -60,6 +60,10 @@ if (Listener != null) Listener.Close(); } + public void HandleClient(Socket client) { + new HTTPContext(this, client); + } + bool TCPServer.IModule.Accept(TCPStream stream) { new HTTPContext(this, stream); return false; @@ -103,6 +107,7 @@ if (socket != null) { this.LocalEndPoint = socket.LocalEndPoint; this.RemoteEndPoint = socket.RemoteEndPoint; + if (socket.ProtocolType == ProtocolType.Tcp) socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); if (stream == null) stream = new NetworkStream(socket, true); } Init(stream);