Esempio n. 1
0
        public byte[] ReceiveMessage()
        {
            var buffer = new byte[2048];

            /*var receivedBytes = */ socket.Receive(buffer);
            return(Crypto.DecryptBytes(buffer));
        }
Esempio n. 2
0
        private void ReceiveMessages(object connectionid)
        {
            var sock = connections[(int)connectionid].socket;

            while (isOnline)
            {
                var buffer = new byte[2048];
                /*var receivedBytes = */ sock.Receive(buffer);
                if (OnReceiveClientMessage != null)
                {
                    OnReceiveClientMessage((int)connectionid, Crypto.DecryptBytes(buffer));
                }
                log.WriteLine("Received a message from " + sock.RemoteEndPoint.ToString() + " (connection-ID: " + connectionid + ")");
            }
        }