PeerContact.PeerEndPoints Proprietà

Definizione

Ottiene l'oggetto PeerEndPointCollection associato a questo oggetto 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

Valore della proprietà

Insieme di oggetti PeerEndPoint associato all'oggetto PeerContact corrente. Il valore predefinito di questa proprietà è null.

Attributi

Eccezioni

L'oggetto PeerContact è stato eliminato.

Esempio

Nell'esempio PeerEndPoints di codice seguente viene illustrato l'utilizzo appropriato della proprietà:

// 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];
}

Commenti

Indipendentemente dal fatto che un PeerEndPoint peer locale, un peer remoto o un peer host per il contatto peer rappresentato da questa istanza non sia rilevante per la presenza dell'endpoint PeerEndPointCollectionPeerEndPoint o dell'oggetto ContactManager.

Si applica a

Vedi anche