/// <summary> /// receive message handler /// </summary> /// <param name="sender">The sender</param> /// <param name="message">The soap envelope message</param> private void Server_ReceiveProbeMessage(IPEndPoint sender, SoapEnvelope message) { WsdHeader header = (WsdHeader)message.Header; ProbeType probe = ((ProbeOp)message.Body).Probe; if (this.receive && (!this.returned.Contains(header.MessageID.Value))) { this.CaptureHeaderRequirements(header); this.CaptureProbeRequirements(probe); PccrdBothRoleCaptureCode.CaptureCommonRequirements(Site); PccrdBothRoleCaptureCode.CaptureTypesElementRequirements(probe.Types, Site); PccrdBothRoleCaptureCode.CaptureScopesElementRequirements(probe.Scopes, Site); ProbeMsg probeMsg = new ProbeMsg(header.MessageID.Value, probe.Types, probe.Scopes.Text[0]); this.ReceiveProbeMessage(sender, probeMsg); } }
/// <summary> /// Receive the pccrd messages /// </summary> /// <param name="sender">The sender</param> /// <param name="message">The soap envelope message</param> private void Client_ReceivePccrdMessage(IPEndPoint sender, SoapEnvelope message) { Status status = new Status(); status.ErrorCode = string.Empty; status.FaultType = FaultType.OK; WsdHeader header = (WsdHeader)message.Header; if (this.startReceiving && (!this.returned.Contains(header.MessageID.Value))) { this.returned.Add(header.MessageID.Value); ProbeMatchesType matches = ((ProbeMatchOp)message.Body).ProbeMatches; this.CaptureHeaderRequirements(header); this.CaptureProbeMatchesRequirements(matches); PccrdBothRoleCaptureCode.CaptureCommonRequirements(Site); foreach (ProbeMatchType match in matches.ProbeMatch) { PccrdBothRoleCaptureCode.CaptureTypesElementRequirements(match.Types, Site); PccrdBothRoleCaptureCode.CaptureScopesElementRequirements(match.Scopes, Site); } ProbeMatchMsg probeMatchMsg = new ProbeMatchMsg(); probeMatchMsg.InstanceId = header.AppSequence.InstanceId.ToString(); probeMatchMsg.MessageNumber = header.AppSequence.MessageNumber; PeerProperties[] result = new PeerProperties[matches.ProbeMatch.Length]; for (int i = 0; i < matches.ProbeMatch.Length; i++) { result[i] = new PeerProperties(); result[i].Address = matches.ProbeMatch[i].EndpointReference.Address.Value; result[i].BlockCount = matches.ProbeMatch[i].Any[0].InnerText; result[i].MetadataVersion = matches.ProbeMatch[i].MetadataVersion; result[i].Scopes = matches.ProbeMatch[i].Scopes.Text[0]; result[i].Types = matches.ProbeMatch[i].Types; result[i].XAddrs = matches.ProbeMatch[i].XAddrs; } probeMatchMsg.Matches = result; this.ReceiveProbeMatchMessage(status, probeMatchMsg); } }