SocketAddress クラスとは? わかりやすく解説

SocketAddress クラス

EndPoint 派生クラスからシリアル化された情報格納します

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

Dim instance As SocketAddress
public class SocketAddress
public ref class SocketAddress
public class SocketAddress
public class SocketAddress
解説解説
使用例使用例

SocketAddress使用してEndPoint クラスインスタンスシリアル化する方法の例を次に示しますシリアル化完了すると、SocketAddress の基になるバイト バッファには、すべての IPEndPoint ステータス情報格納されます。

   'Creates an IpEndPoint.
   Dim ipAddress As IPAddress = Dns.Resolve("www.contoso.com").AddressList(0)
   Dim ipLocalEndPoint As New
 IPEndPoint(ipAddress, 11000)
   
   'Serializes the IPEndPoint. 
   Dim socketAddress As SocketAddress = ipLocalEndPoint.Serialize()
   
   'Verifies that ipLocalEndPoint is now serialized by printing its
 contents.
   Console.WriteLine(("Contents of socketAddress are: "
 + socketAddress.ToString()))
   'Checks the Family property.
   Console.WriteLine(("The address family of socketAddress is:
 " + socketAddress.Family.ToString()))
   'Checks the underlying buffer size.
   Console.WriteLine(("The size of the underlying buffer is: "
 + socketAddress.Size.ToString()))
End Sub 'MySerializeIPEndPointClassMethod
 
//Creates an IpEndPoint.
IPAddress ipAddress = Dns.Resolve("www.contoso.com").AddressList[0];
IPEndPoint ipLocalEndPoint = new IPEndPoint(ipAddress, 11000);

//Serializes the IPEndPoint. 
SocketAddress socketAddress = ipLocalEndPoint.Serialize();

//Verifies that ipLocalEndPoint is now serialized by printing its contents.
Console.WriteLine("Contents of the socketAddress are: " + socketAddress.ToString());
//Checks the Family property.
Console.WriteLine("The address family of the socketAddress is: " + socketAddress.Family.ToString());
//Checks the underlying buffer size.
Console.WriteLine("The size of the underlying buffer is: " + socketAddress.Size.ToString());

//Creates an IpEndPoint.
IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[
 0 ];
IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 );

//Serializes the IPEndPoint.
SocketAddress^ socketAddress = ipLocalEndPoint->Serialize();

//Verifies that ipLocalEndPoint is now serialized by printing its contents.
Console::WriteLine( "Contents of the socketAddress are: {0}", socketAddress
 );
//Checks the Family property.
Console::WriteLine( "The address family of the socketAddress is: {0}",
 socketAddress->Family );
//Checks the underlying buffer size.
Console::WriteLine( "The size of the underlying buffer is: {0}", socketAddress->Size
 );
//Creates an IpEndPoint.
IPAddress ipAddress = (IPAddress)Dns.Resolve(
    "www.contoso.com").get_AddressList().get_Item(0);
IPEndPoint ipLocalEndPoint = new IPEndPoint(ipAddress, 11000);

//Serializes the IPEndPoint. 
SocketAddress socketAddress = ipLocalEndPoint.Serialize();

//Verifies that ipLocalEndPoint is now serialized by printing its 
//contents.
Console.WriteLine(("Contents of the socketAddress are: "
    + socketAddress.ToString()));

//Checks the Family property.
Console.WriteLine(("The address family of the socketAddress is: " 
    + socketAddress.get_Family()));

//Checks the underlying buffer size.
Console.WriteLine(("The size of the underlying buffer is: " 
    + socketAddress.get_Size()));
継承階層継承階層
System.Object
  System.Net.SocketAddress
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SocketAddress クラス」の関連用語

SocketAddress クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SocketAddress クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS