/MEng/System/Runtime/IPEndPoint| ClassPath: | MEng.System.Runtime.IPEndPoint | | Parent ClassPath: | MEng.Object | | Copyable: | Yes | | Final: | Yes |
MEng.System.Runtime.IPEndPoint is used with the socket classes. It defines a 'end point' in socket terminology, which consists of the IP address and port number of a socket, either on the sending or receiving (server or client) sides of a connection. Note that, if you use a DNS name in any of the methods that take a text formatted address, as apposed to a dotted notation name, you risk an exception being thrown if the DNS conversion of the name to a binary format cannot be done. So you might want to default construct and use the Set() method later to set it up, so that you can catch the exception and deal with it better. Nested Classes:
Enum=IPEndPointErrors
CantConvert : "";
GetRemoteName : "";
EndEnum;This enumerated type defines the com port specific exceptions that this class might throw. Note though that other exceptions might be thrown from other classes used by this class or passed into the method. Note that some of them have no associated text because the actual text reported comes from the underlying C++ error that occurred.
Constructors:
Constructor();
Constructor(In] MEng.Card4 BinAddr[In] MEng.Card4 Port);
Constructor(In] MEng.String TextAddr[In] MEng.Card4 Port); The default constructor creates an end point that cannot be used, and requires that the address and port number be set at some point. The second constructor takes a binary IP address (in local endian format) and a port number. The third constructor takes a textual IP address, either a dotted notation or a DNS name.
Final, Const Methods:
GetAddr() Returns MEng.Card4;
GetNetAddr() Returns MEng.Card4; GetAddr() will return the network address field, in the local (native) endianness. GetNetAddr() will return it in the network order, which is always big endian. Windows machines on the Intel platform will be little endian.
GetHostName() Returns MEng.String; This method will return the name of the remote host, if possible. If the initial set of the end point included a DNS name, then a DNS operation would have been done, and the host name validated. If a dotted notation name was given, then the reverse DNS operation (convert the binary address to a host name) will not be done until now, and if could fail if the DNS operation doesn't work, and a GetRemoteName exception will be thrown.
GetPort() Returns MEng.Card4; This method will return the port number of this end point.
GetAsText() Returns MEng.String; Returns a formatted version of the end point, in the same form as that taken by FromText(), below, e.g. "1.2.3.4:1234" or "foobar.com:4321".
Final, Non-Const Methods:
FromText([In] MEng.String TextAttr); This method will take a text formatted address/port and parse it out and set this object with the resulting values. The formats include the dotted notation and the DNS name, e.g. "1.2.3.4:1344" or "foobar.com:4113". If the port isn't present, it will be set to zero. If you provide a badly formatted address, or you use the DNS version and it cannot be looked up via DNS and converted to a binary address, then a CantConvert exception will be thrown.
Set(In] MEng.String TextAddr[In] MEng.Card4 Port); This method can be used to set the end point after a default constructor, or to reset it to some other value. If the text address is invalid or it is a DNS name and the DNS lookup fails, it will throw an CantConvert exception.
SetPort(In] MEng.Card4 Port); This method will set just the port component of the end point, leaving the address component unchanged.
|