Mercurial > hg > ucis.core
diff Net/HTTP.cs @ 45:8df7f4dc5615
HTTP Server: enable KeepAlive option on TCP sockets
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Wed, 12 Jun 2013 23:20:21 +0200 |
parents | fba35b87da32 |
children | ba4e2cb031e0 |
line wrap: on
line diff
--- 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);