コード例 #1
0
ファイル: Connection.cs プロジェクト: cathode/Serenity
        /// <summary>
        /// Initializes a new instance of the <see cref="Connection"/> class.
        /// </summary>
        /// <param name="socket"></param>
        protected Connection(Socket socket)
        {
            Contract.Requires(socket != null);

            this.socket = socket;
            this.socket.ReceiveTimeout = 1000;
            this.socket.SendTimeout = 1000;
            this.buffer = new NetworkBuffer();
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkBufferFrame"/> class.
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="capacity"></param>
        internal NetworkBufferFrame(NetworkBuffer owner, int capacity)
        {
            Contract.Requires(owner != null);
            Contract.Requires(capacity > 0);

            this.content = new byte[capacity];
            this.capacity = capacity;

            this.Owner = owner;
            this.AutoReset = new AutoResetEvent(false);
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpServerAsyncState"/>
        /// class.
        /// </summary>
        /// <param name="connection">The <see cref="Socket"/> representing the connection with the remote client.</param>
        public HttpServerAsyncState(Socket connection)
        {
            Contract.Requires(connection != null);

            this.connection = connection;
            this.buffer = new NetworkBuffer();
            this.rawRequest = new StringBuilder();
            this.currentToken = new StringBuilder();
            this.stage = HttpRequestParseStep.Method;
            this.request = new Request()
            {
                Connection = this.Connection
            };
            this.response = new Response()
            {
                Connection = this.Connection
            };
        }