public class IPEndPoint : EndPoint
Object
EndPoint
IPEndPoint
System
Networking
Represents a network endpoint as an Internet Protocol (IP) address and a port number.
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.
System.Net Namespace
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
public IPEndPoint(long address, int port);
Constructs and initializes a new instance of the IPEndPoint class with the specified address and port number.
- 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.
Exception Type Condition ArgumentOutOfRangeException port is less than System.Net.IPEndPoint.MinPort or greater than System.Net.IPEndPoint.MaxPort. A negative number was specified for address.
System.Net.IPEndPoint Class, System.Net Namespace
public IPEndPoint(IPAddress address, int port);
Constructs and initializes a new instance of the IPEndPoint class with the specified address and port number.
- 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.
Exception Type Condition ArgumentNullException address is null
.ArgumentOutOfRangeException port is less than System.Net.IPEndPoint.MinPort or greater than System.Net.IPEndPoint.MaxPort.
System.Net.IPEndPoint Class, System.Net Namespace
public override EndPoint Create(SocketAddress socketAddress);
Returns a new IPEndPoint instance containing the address information from the specified SocketAddress instance.
- socketAddress
- A SocketAddress instance that provides the address information for the new IPEndPoint instance.
A new IPEndPoint instance containing the address information from the specified SocketAddress instance.
Exception Type Condition ArgumentException The AddressFamily
of the specified SocketAddress is not equal to theAddressFamily
of the current instance.
[Note: This method overrides System.Net.EndPoint.Create(System.Net.SocketAddress) .]
System.Net.IPEndPoint Class, System.Net Namespace
public override bool Equals(object comparand);
Determines whether the current instance and the specified Object represent the same type and value.
- comparand
- The
Object
to compare to the current instance.
true
if comparand represents the same endpoint as the current instance. If comparand is anull
reference or is not an instance of IPEndPoint, returnsfalse
.
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).]
System.Net.IPEndPoint Class, System.Net Namespace
public override int GetHashCode();
Generates a hash code for the current instance.
A Int32 containing the hash code for the current instance.
The algorithm used to generate the hash code is unspecified.[Note: This method overrides System.Object.GetHashCode .]
System.Net.IPEndPoint Class, System.Net Namespace
public override string ToString();
Returns a String representation of the value of the current instance.
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.
[Note: This method overrides System.Object.ToString.]
System.Net.IPEndPoint Class, System.Net Namespace
public const int MaxPort = 65535;
Specifies the maximum value that can be assigned to the System.Net.IPEndPoint.Port property.
This field is read-only. The value of this field is 65535.
System.Net.IPEndPoint Class, System.Net Namespace
public const int MinPort = 0;
Specifies the minimum value that can be assigned to the System.Net.IPEndPoint.Port property.
This field is read-only. The value of this field is zero.
System.Net.IPEndPoint Class, System.Net Namespace
public IPAddress Address { get; set; }
Gets or sets the IP address of the endpoint.
A IPAddress instance containing the IP address of the end point.
System.Net.IPEndPoint Class, System.Net Namespace
public override AddressFamily AddressFamily { get; }
Gets the Internet Protocol (IP) address family.
Returns System.Net.Sockets.AddressFamily.InterNetwork .
This property is read-only.
System.Net.IPEndPoint Class, System.Net Namespace
public int Port { get; set; }
Gets or sets the port number of the endpoint.
A Int32 value that is between System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort inclusive.
Exception Type Condition ArgumentOutOfRangeException The value specified for a set operation was less than System.Net.IPEndPoint.MinPort or greater than System.Net.IPEndPoint.MaxPort.
System.Net.IPEndPoint Class, System.Net Namespace