Пример #1
0
        private void Send(byte[] data, int offset, int size)
        {
            if (this._socket == null)
            {
                return;
            }

            data = LengthEncoder.Encode(data, offset, size);
            try
            {
                this._socket.Send(data, 0, data.Length, SocketFlags.None);
            }
            catch (SocketException e)
            {
                this.MarkToClose(e.ToString(), e.SocketErrorCode);
            }
        }
Пример #2
0
 public void Send(byte[] data, int offset, int size)
 {
     if (this._conn == null)
     {
         return;
     }
     data = LengthEncoder.Encode(data, offset, size);
     try
     {
         this._conn.Send(data, 0, data.Length, SocketFlags.None);
     }
     catch (ObjectDisposedException)
     {
     }
     catch (SocketException e)
     {
         this.MarkToDisconnect($"Client send error, remote Address: {this.remoteEndPoint}", e.SocketErrorCode);
     }
 }