示例#1
0
        public void Send(Protocol protocol)
        {
            try
            {
                byte[] sendBytes = protocol.ToByteArray();

                this.stream.Write(sendBytes, 0, sendBytes.Length);
            }
            catch
            {
                this.FireOnConnectionLost();
            }
        }
示例#2
0
        public void Send(Protocol protocol)
        {
            lock (locker)
            {
                try
                {
                    byte[] sendBytes = protocol.ToByteArray();

                    if (this.playerStream.CanWrite)
                    {
                        this.playerStream.Write(sendBytes, 0, sendBytes.Length);
                    }
                }
                catch
                {
                    this.FireOnConnectionLost();
                }
            }
        }