PeerContact.PeerEndPoints Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the PeerEndPointCollection associated with this PeerContact.
public:
virtual property System::Net::PeerToPeer::Collaboration::PeerEndPointCollection ^ PeerEndPoints { System::Net::PeerToPeer::Collaboration::PeerEndPointCollection ^ get(); };
public override System.Net.PeerToPeer.Collaboration.PeerEndPointCollection PeerEndPoints { [System.Security.SecurityCritical] get; }
[<get: System.Security.SecurityCritical>]
member this.PeerEndPoints : System.Net.PeerToPeer.Collaboration.PeerEndPointCollection
Public Overrides ReadOnly Property PeerEndPoints As PeerEndPointCollection
Property Value
The PeerEndPoint collection associated with this PeerContact. The default value for this property is null
.
- Attributes
Exceptions
This PeerContact object has been disposed.
Examples
The following code example illustrates the proper usage of the PeerEndPoints property:
// If more than one endpoint for a contact exists, let the user choose which to use.
//Parameters:
// pContact - contact to pick an endpoint for
// return value: pPeerEndpoint - the endpoint the user picked
private static PeerEndPoint PickEndpointForContact(PeerContact pContact)
{
PeerEndPointCollection endPointCollection = pContact.PeerEndPoints;
if (endPointCollection == null)
{
Console.WriteLine("Cannot return endpoint for contact {0} -- PeerEndPointCollection is null.", pContact);
return null;
}
if (endPointCollection.Count == 0)
{
Console.WriteLine("Cannot return endpoint for contact {0} -- PeerEndPointCollection is empty.", pContact);
return null;
}
foreach (PeerEndPoint pep in endPointCollection)
{
Console.WriteLine("PeerEndPoint is {0}:" , pep);
Console.WriteLine("PeerEndPoint information:\n Name: {0}\n IP Address: {1}\n Port: {2}\n",
pep.Name,
pep.EndPoint.Address,
pep.EndPoint.Port);
}
return endPointCollection[0];
}
Remarks
Whether a PeerEndPoint is a local peer, remote peer, or host peer for the peer contact represented by this instance is not relevant to the presence of the PeerEndPoint in either the endpoint PeerEndPointCollection or the ContactManager.