public void SendPacket(byte[] data)
        {
            if (!WorkSocket.Connected)
            {
                return;
            }

            try
            {
                lock (Writer)
                {
                    Writer.Position = 0;
                    Writer.Write(data);

                    var packet = Writer.ToPacket();
                    {
                        Encryption.Transform(packet);
                        AddBuffer(packet.ToArray());
                    }
                }
            }
            catch (Exception)
            {
                //ignore
            }
        }
        public void Send(NetworkPacketWriter lpData)
        {
            if (!Socket.Connected)
            {
                return;
            }

            if (InMapTransition)
            {
                return;
            }

            lock (ServerContext.SyncLock)
            {
                var packet = lpData.ToPacket();
                Encryption.Transform(packet);

                var array = packet.ToArray();

                if (Socket.Connected)
                {
                    Socket.Send(array, SocketFlags.None);
                }
            }
        }
        public void Send(NetworkPacketWriter lpData)
        {
            var packet = lpData.ToPacket();

            Encryption.Transform(packet);

            lock (syncLock)
            {
                var array = packet.ToArray();
                SendBuffer.Enqueue(array);
            }
        }
        public void Send(NetworkPacketWriter lpData)
        {
            var packet = lpData.ToPacket();

            Encryption.Transform(packet);

            var array = packet.ToArray();

            if (Session.ConnectedSocket.Connected)
            {
                Session.ConnectedSocket.Send(array, SocketFlags.None);
            }
        }
예제 #5
0
 public void Send(NetworkPacketWriter npw)
 {
     try
     {
         var packet = npw.ToPacket();
         {
             Encryption.Transform(packet);
             Socket.Send(packet.ToArray());
         }
     }
     catch (Exception)
     {
         //ignore
     }
 }