System.Net.IPEndPoint Class

public class IPEndPoint : EndPoint

Base Types

Object
  EndPoint
    IPEndPoint

Assembly

System

Library

Networking

Summary

Represents a network endpoint as an Internet Protocol (IP) address and a port number.

Description

The IPEndPoint class contains the IP address of a host system and the number of a port to access on the host. The IPEndPoint class represents a connection point used by the Socket class.

See Also

System.Net Namespace

Members

IPEndPoint Constructors

IPEndPoint(long, int) Constructor
IPEndPoint(System.Net.IPAddress, int) Constructor

IPEndPoint Methods

IPEndPoint.Create Method
IPEndPoint.Equals Method
IPEndPoint.GetHashCode Method
IPEndPoint.ToString Method

IPEndPoint Fields

IPEndPoint.MaxPort Field
IPEndPoint.MinPort Field

IPEndPoint Properties

IPEndPoint.Address Property
IPEndPoint.AddressFamily Property
IPEndPoint.Port Property


IPEndPoint(long, int) Constructor

public IPEndPoint(long address, int port);

Summary

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

Parameters

address
A Int64 containing the IP address of the endpoint.
port
A Int32 containing the port number to use when accessing address . Specify zero to indicate any available port.

Exceptions

Exception TypeCondition
ArgumentOutOfRangeExceptionport is less than System.Net.IPEndPoint.MinPort or greater than System.Net.IPEndPoint.MaxPort.

A negative number was specified for address.

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint(System.Net.IPAddress, int) Constructor

public IPEndPoint(IPAddress address, int port);

Summary

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

Parameters

address
A IPAddress instance containing the IP address of the endpoint.
port
The port number to use when accessing address . Specify zero to indicate any available port.

Exceptions

Exception TypeCondition
ArgumentNullExceptionaddress is null .
ArgumentOutOfRangeExceptionport is less than System.Net.IPEndPoint.MinPort or greater than System.Net.IPEndPoint.MaxPort.

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.Create Method

public override EndPoint Create(SocketAddress socketAddress);

Summary

Returns a new IPEndPoint instance containing the address information from the specified SocketAddress instance.

Parameters

socketAddress
A SocketAddress instance that provides the address information for the new IPEndPoint instance.

Return Value

A new IPEndPoint instance containing the address information from the specified SocketAddress instance.

Exceptions

Exception TypeCondition
ArgumentExceptionThe AddressFamily of the specified SocketAddress is not equal to the AddressFamily of the current instance.

Description

[Note: This method overrides System.Net.EndPoint.Create(System.Net.SocketAddress) .]

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.Equals Method

public override bool Equals(object comparand);

Summary

Determines whether the current instance and the specified Object represent the same type and value.

Parameters

comparand
The Object to compare to the current instance.

Return Value

true if comparand represents the same endpoint as the current instance. If comparand is a null reference or is not an instance of IPEndPoint, returns false .

Description

Two IPEndPoint instances are equal if their System.Net.IPEndPoint.Address and System.Net.IPEndPoint.Port properties contain the same values.

[Note: This method overrides System.Object.Equals(System.Object).]

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.GetHashCode Method

public override int GetHashCode();

Summary

Generates a hash code for the current instance.

Return Value

A Int32 containing the hash code for the current instance.

Description

The algorithm used to generate the hash code is unspecified.

[Note: This method overrides System.Object.GetHashCode .]

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.ToString Method

public override string ToString();

Summary

Returns a String representation of the value of the current instance.

Return Value

A String containing the IP address, in dotted-quad notation, followed by a colon and the port number for the specified endpoint, for example, 127.0.0.1:80.

Description

[Note: This method overrides System.Object.ToString.]

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.MaxPort Field

public const int MaxPort = 65535;

Summary

Specifies the maximum value that can be assigned to the System.Net.IPEndPoint.Port property.

Description

This field is read-only. The value of this field is 65535.

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.MinPort Field

public const int MinPort = 0;

Summary

Specifies the minimum value that can be assigned to the System.Net.IPEndPoint.Port property.

Description

This field is read-only. The value of this field is zero.

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.Address Property

public IPAddress Address { get; set; }

Summary

Gets or sets the IP address of the endpoint.

Property Value

A IPAddress instance containing the IP address of the end point.

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.AddressFamily Property

public override AddressFamily AddressFamily { get; }

Summary

Gets the Internet Protocol (IP) address family.

Property Value

Returns System.Net.Sockets.AddressFamily.InterNetwork .

Description

This property is read-only.

See Also

System.Net.IPEndPoint Class, System.Net Namespace

IPEndPoint.Port Property

public int Port { get; set; }

Summary

Gets or sets the port number of the endpoint.

Property Value

A Int32 value that is between System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort inclusive.

Exceptions

Exception TypeCondition
ArgumentOutOfRangeExceptionThe value specified for a set operation was less than System.Net.IPEndPoint.MinPort or greater than System.Net.IPEndPoint.MaxPort.

See Also

System.Net.IPEndPoint Class, System.Net Namespace