PeerContact.PeerEndPoints プロパティ

定義

この PeerEndPointCollection に関連付けられている 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

プロパティ値

この PeerEndPoint に関連付けられている PeerContact コレクション。 このプロパティの既定値は、null です。

属性

例外

この PeerContact オブジェクトは破棄されました。

次のコード例は、 プロパティの適切な使用方法を PeerEndPoints 示しています。

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

注釈

がこのインスタンスによって表されるピア連絡先のローカル ピア、リモート ピア、またはホスト ピアであるかどうかPeerEndPointは、エンドポイントPeerEndPointCollectionまたは ContactManager内の のPeerEndPoint存在とは関係ありません。

適用対象

こちらもご覧ください