예제 #1
0
파일: Program.cs 프로젝트: Greeley/Samples
 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;
 }
예제 #3
0
 public ChannelFailureEventArgs(SocketChannel channel, Exception exception)
 {
     Channel = channel;
     Exception = exception;
 }
예제 #4
0
 private void OnHttpMsg(SocketChannel channel, object obj)
 {
     RequestHandler(channel, (HttpRequestBase) obj);
 }
예제 #5
0
 public ChannelFailureEventArgs(SocketChannel channel, SocketError socketError)
 {
     Channel = channel;
     SocketError = socketError;
 }