Table of Contents

Class IPEndPoint

Namespace
System.Net
Assembly
System.Net.dll

Represents a network endpoint as an IP address and a port number.

public class IPEndPoint : EndPoint
Inheritance
IPEndPoint
Inherited Members
Extension Methods

Constructors

IPEndPoint(long, int)

Initializes a new instance of the IPEndPoint class with the specified address and port number.

public IPEndPoint(long address, int port)

Parameters

address long

The IP address of the Internet host.

port int

The port number associated with the address, or 0 to specify any available port. port is in host order.

IPEndPoint(IPAddress, int)

Initializes a new instance of the IPEndPoint class with the specified address and port number.

public IPEndPoint(IPAddress address, int port)

Parameters

address IPAddress
port int

Fields

MaxPort

Specifies the maximum value that can be assigned to the Port property. The MaxPort value is set to 0x0000FFFF. This field is read-only.

public const int MaxPort = 65535

Field Value

int

MinPort

Specifies the minimum value that can be assigned to the Port property. This field is read-only.

public const int MinPort = 0

Field Value

int

Properties

Address

Gets or sets the IP address of the endpoint.

public IPAddress Address { get; }

Property Value

IPAddress

An IPAddress instance containing the IP address of the endpoint.

AddressFamily

Gets the Internet Protocol (IP) address family.

public AddressFamily AddressFamily { get; }

Property Value

AddressFamily

Returns InterNetwork.

Port

Gets or sets the port number of the endpoint.

public int Port { get; }

Property Value

int

An integer value in the range MinPort to MaxPort indicating the port number of the endpoint.

Methods

Create(SocketAddress)

Creates an endpoint from a socket address.

public override EndPoint Create(SocketAddress socketAddress)

Parameters

socketAddress SocketAddress

The SocketAddress to use for the endpoint.

Returns

EndPoint

An EndPoint instance using the specified socket address.

Equals(object)

Determines whether the specified Object is equal to the current IPEndPoint instance.

public override bool Equals(object obj)

Parameters

obj object

The specified Object to compare with the current IPEndPoint instance.

Returns

bool

true if the objects are equal.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Serialize()

Serializes endpoint information into a SocketAddress instance.

public override SocketAddress Serialize()

Returns

SocketAddress

A SocketAddress instance containing the socket address for the endpoint.

ToString()

Returns the IP address and port number of the specified endpoint.

public override string ToString()

Returns

string

A string containing the IP address and the port number of the specified endpoint (for example, 192.168.1.2:80).