Beispiel #1
0
        public BroadcastMessage(SerializedPacket p)
        {
            SerializedPacket.VerifyPacket(p, this.GetClassId());
            this.EndPoints = null;
            if (SerializedPacket.DeserializeBool(p.GetNextPart()))
            {
                this.EndPoints = new IPEndPoint[SerializedPacket.DeserializeInt(p.GetNextPart())];
                for (int i = 0; i < this.EndPoints.Length; i++)
                {
                    this.EndPoints[i] = SerializedPacket.DeserializeIPEndPoint(p.GetNextPart());
                }
            }
            this.HumanName        = SerializedPacket.DeserializeString(p.GetNextPart());
            this.SenderID         = SerializedPacket.DeserializeGuid(p.GetNextPart());
            this.PresentationName = SerializedPacket.DeserializeString(p.GetNextPart());
            this.ShowIP           = SerializedPacket.DeserializeBool(p.GetNextPart());

/*
 * //CMPRINCE DEBUGGING
 *          string IPs = "";
 *          foreach( IPEndPoint ep in this.EndPoints ) {
 *              IPs += ep.Address.ToString() + " ";
 *          }
 *          System.Diagnostics.Debug.Write( "RECVD: BroadcastListener: " +
 *              IPs +
 *              this.HumanName + " " +
 *              this.SenderID.ToString() + " " +
 *              this.PresentationName +
 *              System.Environment.NewLine
 *              );
 */
        }
        public TCPHandshakeMessage(SerializedPacket p)
        {
            SerializedPacket.VerifyPacket(p, this.GetClassId());
            this.ParticipantId = SerializedPacket.DeserializeGuid(p.GetNextPart());
            this.EndPoint      = (!SerializedPacket.IsNullPacket(p.PeekNextPart())) ?
                                 SerializedPacket.DeserializeIPEndPoint(p.PeekNextPart()) : null; p.GetNextPart();
            this.HumanName           = SerializedPacket.DeserializeString(p.GetNextPart());
            this.LastMessageSequence = SerializedPacket.DeserializeULong(p.GetNextPart());
            this.LastChunkSequence   = SerializedPacket.DeserializeULong(p.GetNextPart());

            System.Diagnostics.Debug.Write("TCPHandshakeMessage: " +
                                           this.ParticipantId.ToString() + " " +
                                           ((this.EndPoint != null) ? (this.EndPoint.Address.ToString() + ":" + this.EndPoint.Port.ToString() + " ") : "") +
                                           this.HumanName + " " +
                                           this.LastMessageSequence + " " +
                                           this.LastChunkSequence +
                                           System.Environment.NewLine);
        }