public void Send(string command)
 {
     SocketSender.Send(
         MaxUDPPacketSize,
         command,
         encodedCommand => UDPSocket.SendTo(encodedCommand, encodedCommand.Length, SocketFlags.None, IPEndpoint));
 }
 public Task SendAsync(string command)
 {
     return(SocketSender.SendAsync(
                IPEndpoint,
                UDPSocket,
                MaxUDPPacketSize,
                new ArraySegment <byte>(Encoding.UTF8.GetBytes(command))));
 }
        public void Send(string command)
        {
            if (!_socket.Connected)
            {
                lock (_socketLock)
                {
                    if (!_socket.Connected)
                    {
                        _socket.Connect(_endPoint);
                    }
                }
            }

            SocketSender.Send(_maxPacketSize, command,
                              encodedCommand => _socket.Send(encodedCommand));
        }
 public Task SendAsync(string command)
 {
     return(SocketSender.SendAsync(_endPoint, _socket, _maxPacketSize,
                                   new ArraySegment <byte>(Encoding.UTF8.GetBytes(command))));
 }