示例#1
0
        private void SendAttributeReply(IPEndPoint target, short transactionId)
        {
            AttributeReplyPacket reply = new AttributeReplyPacket();

            FillHeader(reply.Header, transactionId);
            reply.AttrList = AttributeString;
            socket.Send(target, reply);
        }
示例#2
0
 /// <summary>
 /// Processes the attribute reply.
 /// </summary>
 /// <param name="attributeReply">The attribute reply packet.</param>
 /// <param name="ipAddress">The ip address the reply originated from.</param>
 protected void ProcessAttributeReply(AttributeReplyPacket attributeReply, IPEndPoint ipAddress)
 {
     if (attributeReply.ErrorCode == SlpErrorCode.None)
     {
         AttributeReplyEventArgs args = new AttributeReplyEventArgs()
         {
             Address = ipAddress, RequestId = attributeReply.Header.XId
         };
         args.Attributes = SplitAttributeList(attributeReply.AttrList);
         if (AttributeReply != null)
         {
             AttributeReply(this, args);
         }
     }
 }
示例#3
0
        protected override void ProcessPacket(NewPacketEventArgs packetInfo)
        {
            DirectoryAgentAdvertPacket daAdvert = packetInfo.Packet as DirectoryAgentAdvertPacket;

            if (daAdvert != null)
            {
                DirectoryAgent = new DirectoryAgentInformation(daAdvert.Url, packetInfo.SourceEndPoint);
            }


            ServiceReplyPacket serviceReply = packetInfo.Packet as ServiceReplyPacket;

            if (serviceReply != null)
            {
                ProcessServiceReply(serviceReply, packetInfo.SourceEndPoint);
            }

            AttributeReplyPacket attributeReply = packetInfo.Packet as AttributeReplyPacket;

            if (attributeReply != null)
            {
                ProcessAttributeReply(attributeReply, packetInfo.SourceEndPoint);
            }
        }