This topic has not yet been rated - Rate this topic

PeerContact.PeerEndPoints Property

Gets the PeerEndPointCollection associated with this PeerContact.

Namespace:  System.Net.PeerToPeer.Collaboration
Assembly:  System.Net (in System.Net.dll)
public override PeerEndPointCollection PeerEndPoints { get; }

Property Value

Type: System.Net.PeerToPeer.Collaboration.PeerEndPointCollection
The PeerEndPoint collection associated with this PeerContact. The default value for this property is null.

This PeerContact object has been disposed.

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.

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. 
//   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", 

    return endPointCollection[0];

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.