private void SendServiceReply(IPEndPoint target, short transactionId) { ServiceReplyPacket reply = new ServiceReplyPacket(); FillHeader(reply.Header, transactionId); reply.Urls.Add(new UrlEntry(ServiceUrl)); socket.Send(target, reply); }
protected void ProcessServiceReply(ServiceReplyPacket serviceReply, IPEndPoint ipAddress) { if (serviceReply.ErrorCode == SlpErrorCode.None && serviceReply.Urls.Count > 0) { if (ServiceFound != null) { ServiceFound(this, new ServiceFoundEventArgs(serviceReply.Urls, ipAddress) { RequestId = serviceReply.Header.XId }); } } }
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); } }