示例#1
0
 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);
 }
示例#2
0
 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;
 }
示例#4
0
 private void OnHttpMsg(SocketChannel channel, object obj)
 {
     RequestHandler(channel, (HttpRequestBase) obj);
 }
 public ChannelFailureEventArgs(SocketChannel channel, SocketError socketError)
 {
     Channel = channel;
     SocketError = socketError;
 }