private static void OnRequests(SocketChannel channel, HttpRequestBase request) { var response = request.CreateResponse(); response.StatusCode = 200; response.Body = GetStream(); response.AddHeader("Keep-Alive", "timeout=15, max=100"); response.Body.Write(Encoding.ASCII.GetBytes("HelloWorld"), 0, 10); channel.Send(response); }
private SocketChannel CreateChannel() { var channel = new SocketChannel(new BufferSlice(65535)); channel.ChannelFailed += OnChannelFailed; var decoder = new HttpDecoder {MessageReceived = msg => { OnHttpMsg(channel, msg); }}; channel.Decoder = decoder; channel.Encoder = new HttpEncoder(_mgr); return channel; }
public ChannelFailureEventArgs(SocketChannel channel, Exception exception) { Channel = channel; Exception = exception; }
private void OnHttpMsg(SocketChannel channel, object obj) { RequestHandler(channel, (HttpRequestBase) obj); }
public ChannelFailureEventArgs(SocketChannel channel, SocketError socketError) { Channel = channel; SocketError = socketError; }