예제 #1
0
        /// <summary>
        /// Sends the specified packet to LFS asynchronously.
        /// </summary>
        /// <param name="packet">The<see cref="ISendable"/> packet to send.</param>
        /// <returns>An awaitable async task object.</returns>
        public Task SendAsync(ISendable packet)
        {
            if (packet == null)
            {
                throw new ArgumentNullException("packet");
            }

            ThrowIfDisposed();
            ThrowIfNotConnected();

            return(TcpSocket.SendAsync(packet.GetBuffer()));
        }
예제 #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
 private void HandleSend(ISendable packet) {
     if (socket.IsConnected) {
         socket.Send(packet.GetBuffer());
     }
 }