Exemple #1
0
 public NetworkMessage(MessageTypes type, object data, NetworkId senderId, NetworkId messageId, NetworkId responseTo)
 {
     MessageType = type;
     Data        = data;
     SenderId    = senderId;
     MessageId   = messageId;
     ResponseTo  = responseTo;
 }
Exemple #2
0
        public void Disconnect(bool sendDisconnectMessage)
        {
            if (sendDisconnectMessage)
            {
                new NetworkMessage(MessageTypes.Disconnect, null, Id, NetworkId.Generate()).Send(stream);
            }

            reading = false;
            Thread.Sleep(16);
            stream.Close();
            client.Close();

            OnDisconnected?.Invoke(this, Id);
        }
Exemple #3
0
 public NetworkMessage(MessageTypes type, object data, NetworkId senderId, NetworkId messageId) : this(type, data, senderId, messageId, NetworkId.Empty)
 {
 }