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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SocketAddress コンストラクタ (AddressFamily)


SocketAddress コンストラクタ


SocketAddress コンストラクタ (AddressFamily, Int32)

指定したアドレス ファミリバッファ サイズ使用して、SocketAddress クラス新しインスタンス作成します

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

Public Sub New ( _
    family As AddressFamily, _
    size As Integer _
)
Dim family As AddressFamily
Dim size As Integer

Dim instance As New SocketAddress(family,
 size)
public SocketAddress (
    AddressFamily family,
    int size
)
public:
SocketAddress (
    AddressFamily family, 
    int size
)
public SocketAddress (
    AddressFamily family, 
    int size
)
public function SocketAddress (
    family : AddressFamily, 
    size : int
)

パラメータ

family

AddressFamily 列挙値。

size

基になるバッファ割り当てるバイト数。

例外例外
例外種類条件

ArgumentOutOfRangeException

size は 2 未満です。この 2 バイトは、family格納するために必要です。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SocketAddress プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Size SocketAddress の基になるバッファ サイズ取得します
参照参照

関連項目

SocketAddress クラス
System.Net 名前空間

SocketAddress メソッド


SocketAddress メンバ

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

SocketAddress データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Size SocketAddress の基になるバッファ サイズ取得します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SocketAddress クラス
System.Net 名前空間



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

辞書ショートカット

すべての辞書の索引

「SocketAddress」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS