示例#1
0
 private void HandleKeepAlive(PacketType type, byte[] buffer)
 {
     if (type == PacketType.ISP_TINY)
     {
         IS_TINY tiny = new IS_TINY(buffer);
         if (tiny.SubT == TinyType.TINY_NONE)
         {
             TcpSocket.Send(buffer);
         }
     }
 }
示例#2
0
        /// <summary>
        /// Sends the specified packet to LFS.
        /// </summary>
        /// <param name="packet">The<see cref="ISendable"/> packet to send.</param>
        public void Send(ISendable packet)
        {
            if (packet == null)
            {
                throw new ArgumentNullException("packet");
            }

            ThrowIfDisposed();
            ThrowIfNotConnected();

            TcpSocket.Send(packet.GetBuffer());
        }
示例#3
0
        /// <summary>
        /// Sends the specified sequence of packets to LFS.
        /// </summary>
        /// <param name="packets">The sequence of <see cref="ISendable"/> packets to send.</param>
        public void Send(params ISendable[] packets)
        {
            if (packets == null)
            {
                throw new ArgumentNullException("packets");
            }

            ThrowIfDisposed();
            ThrowIfNotConnected();

            TcpSocket.Send(GetSendBuffer(packets));
        }
示例#4
0
        /// <summary>
        /// Sends the specified sequence of packets to LFS.
        /// </summary>
        /// <param name="packets">The sequence of <see cref="ISendable"/> packets to send.</param>
        public void Send(IEnumerable <ISendable> packets)
        {
            if (packets == null)
            {
                throw new ArgumentNullException("packets");
            }

            ThrowIfDisposed();
            ThrowIfNotConnected();

            int         size   = packets.Sum(p => p.Size);
            List <byte> buffer = new List <byte>(size);

            foreach (ISendable packet in packets)
            {
                buffer.AddRange(packet.GetBuffer());
            }
            TcpSocket.Send(buffer.ToArray());
        }