public FastCGIConnection(FastCGIServer owner, TcpSocket socket) { _owner = owner; _receiveState = ReceiveState.Header; _socket = socket; _socket.NoDelay = true; _socket.ReceiveBuffer(new ArraySegment <byte>(_headerBuffer)); _socket.OnData += OnData; _socket.ReceiveStart(); }
public void End() { _socket.Flush(); _msg = null; if (_parser.ShouldKeepAlive()) { _parser.Pause(false); if (_pausedData.Count > 0) { var data = _pausedData; _pausedData = new ArraySegment <byte>(); OnData(_socket, data); } if (_parser.Errno == HttpParserError.OK) { _socket.ReceiveStart(); } } else { Close(); } }
internal WebSocket(TcpSocket socket, HttpServerRequest context, ArraySegment <byte> head) { _context = context; _socket = socket; _socket.OnData += OnData; _socket.OnDisconnected += OnSocketDisconnected; _recvstate = RecvStat.Start1; _fragmented = 0; _payloadData = new BufferData(); _sendingQueue = new BufferData(); _sendingTextMode = false; _sendingMaskMode = false; _isserver = true; _state = SocketStat.Open; if (head.Count > 0) { OnData(_socket, head); } _socket.NoDelay = true; _socket.ReceiveStart(); }