예제 #1
0
        /// <summary>
        /// Send the data to the client.
        /// </summary>
        private void SendData()
        {
            // Get the data from the response stream.
            byte[] buffer = new byte[ReadBufferSize];

            // Send all in buffer until empty.
            while (_responseStream != null && _responseStream.Length > 0)
            {
                // Read the data.
                int byesRead = _responseStream.ReadFromStream(buffer, 0, buffer.Length);

                // Send to client if bytes have been read.
                if (byesRead > 0)
                {
                    // Lock the socket receive process.
                    lock (ServerRef.LockingSocket)
                    {
                        // Send the data back to the client.
                        _socket.SendTo(buffer, 0, byesRead, _sendSocketFlags, RemoteClient);
                    }

                    // If the time out control has been created
                    // then reset the timer.
                    InActiveTimeOutSetter();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Send the data to the client.
        /// </summary>
        /// <returns>Return the data that needs to be sent.</returns>
        private byte[] SendData()
        {
            // Get the data from the response stream.
            int byesRead = _responseStream.ReadFromStream(_buffer.WriteBuffer, 0, _buffer.WRITE_BUFFER_SIZE);

            // Send to client if bytes have been read.
            if (byesRead > 0)
            {
                return(_buffer.WriteBuffer.Take(byesRead).ToArray());
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        /// <summary>
        /// Send the data to the client.
        /// </summary>
        private void SendData()
        {
            // Get the data from the response stream.
            byte[] buffer = new byte[base.ReadBufferSize];

            // Send all in buffer until empty.
            while (_responseStream != null && _responseStream.Length > 0)
            {
                // Read the data.
                int byesRead = _responseStream.ReadFromStream(buffer, 0, buffer.Length);

                // Send to client if bytes have been read.
                if (byesRead > 0)
                {
                    // Send the data back to the client.
                    base.Send(buffer.Take(byesRead).ToArray());
                }
            }
        }