Example #1
0
        public bool Connect(IPAddress address)
        {
            if (!_client.Connect(address))
            {
                return(false);
            }

            _client.SendMessage(new Message
            {
                Code = MessageCode.CONNECT,
                Body = new ByteArrayWriter().Append(Protocol.VERSION).Array
            });

            return(true);
        }
Example #2
0
        public void Send(Message message)
        {
            if (!Connected)
            {
                return;
            }

            _client.SendMessage(message);

            if (Connected)
            {
                Shake();
            }
            else
            {
                ConnectedUser.Id = -1;
            }
        }