Module Interface IO:Address

SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST

# IO:Address

### Import List

        Exception
        Exception
        IO
        Object
        Object

Class List
Inet |
Inet4 |
Socket |
SocketInet |
UnknownHostException |

Class Summary: Inet [Detail]
      +---Object.Object
           |
           +--IO:Address.Inet
Constructor Summary
GetByName(String8): Inet Determines the IP address of a host, given the host's DNS name.
Inherited Methods
From Object.Object: Equals, HashCode, ToString

Class Summary: Inet4 [Detail]
      +---Object.Object
           |
           +---IO:Address.Inet
                |
                +--IO:Address.Inet4
Method Summary
Equals(Object): BOOLEAN Indicates whether some other object is "equal to" this one.
HashCode(): Hash Returns a hash code value for the object.
ToString(): STRING Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode, ToString

Class Summary: Socket [Detail]
      +---Object.Object
           |
           +--IO:Address.Socket
Method Summary
GetSockAddr(): SockAddr Return the socket address s, in the format expected by the functions of libc.
Inherited Methods
From Object.Object: Equals, HashCode, ToString

Class Summary: SocketInet [Detail]
      +---Object.Object
           |
           +---IO:Address.Socket
                |
                +--IO:Address.SocketInet
Field Summary
host-: Inet IP address of the host.
port-: Port Port number of the socket.
Constructor Summary
GetSocketInet(Inet, Port): SocketInet Return an Internet socket address for the given host address and port number.
Method Summary
Equals(Object): BOOLEAN Indicates whether some other object is "equal to" this one.
GetSockAddr(): SockAddr Return the socket address s, in the format expected by the functions of libc.
HashCode(): Hash Returns a hash code value for the object.
ToString(): STRING Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode, ToString From IO:Address.Socket: GetSockAddr

Class Summary: UnknownHostException [Detail]
      +---Exception.Exception
           |
           +---IO.Error
                |
                +--IO:Address.UnknownHostException
Inherited Methods
From Exception.Exception: GetMessage, Name, WriteBacktrace From IO.Error: INIT

Type Summary
Port = LONGINT Port number of an Internet host.
SockAddr = POINTER TO ARRAY OF CHAR

Variable Summary
inet4Any-: Inet4 Stands for "any incoming address" when binding to an address.
inet4Broadcast-: Inet4 The address to send a broadcast message.
inet4Loopback-: Inet4 The internet address ``127.0.0.1`' referring to this machine, typically called ``localhost`'.

Class Detail: Inet

Constructor Detail

### GetByName

    PROCEDURE GetByName(host: String8): Inet
      RAISES UnknownHostException;

> Determines the IP address of a host, given the host's DNS name. The host name NIL refers to the local host.

Class Detail: Inet4

Method Detail

### Equals

    PROCEDURE (addr: Inet4) Equals(y: Object): BOOLEAN

> Indicates whether some other object is "equal to" this one.

> The Object.Equals method implements an equivalence relation:

> - It is reflexive: for any reference value ``x`', ``x.Equals(x)`' should return TRUE.

> - It is symmetric: for any reference values ``x`' and ``y`', ``x.Equals(y)`' should return TRUE if and only if ``y.Equals(x)`' returns TRUE.

> - It is transitive: for any reference values ``x`', ``y`', and ``z`', if ``x.Equals(y)`' returns TRUE and ``y.Equals(z)`' returns TRUE, then ``x.Equals(z)`' should return TRUE.

> - It is consistent: for any reference values ``x`' and ``y`', multiple invocations of ``x.Equals(y)`' consistently return TRUE or consistently return FALSE, provided no information used in equals comparisons on the object is modified.

> - For any non-NIL reference value ``x`', ``x.Equals(NIL)`' should return FALSE.

> The ``Equals`' method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values ``x`' and ``y`', this method returns TRUE if and only if ``x`' and ``y`' refer to the same object (``x=y`' has the value TRUE).

> [Description inherited from Equals]

> Redefines: Equals, Equals

### HashCode

    PROCEDURE (addr: Inet4) HashCode(): Hash

> Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary..

> The general contract of Object.HashCode is:

> - Whenever it is invoked on the same object more than once during an execution of an application, the Object.HashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.

> - If two objects are equal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce the same integer result.

> - It is not required that if two objects are unequal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of dictionaries.

> As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)

> [Description inherited from HashCode]

> Redefines: HashCode, HashCode

### ToString

    PROCEDURE (addr: Inet4) ToString(): STRING

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString, ToString

Class Detail: Socket

Method Detail

### GetSockAddr

    PROCEDURE (s: Socket) GetSockAddr(): SockAddr

> Return the socket address s, in the format expected by the functions of libc.

Class Detail: SocketInet

Field Detail

### host

    FIELD host-: Inet

> IP address of the host.

### port

    FIELD port-: Port

> Port number of the socket. A number between zero and 65535.

Constructor Detail

### GetSocketInet

    PROCEDURE GetSocketInet(host: Inet;
                            port: Port): SocketInet

> Return an Internet socket address for the given host address and port number.

Method Detail

### Equals

    PROCEDURE (s: SocketInet) Equals(y: Object): BOOLEAN

> Indicates whether some other object is "equal to" this one.

> The Object.Equals method implements an equivalence relation:

> - It is reflexive: for any reference value ``x`', ``x.Equals(x)`' should return TRUE.

> - It is symmetric: for any reference values ``x`' and ``y`', ``x.Equals(y)`' should return TRUE if and only if ``y.Equals(x)`' returns TRUE.

> - It is transitive: for any reference values ``x`', ``y`', and ``z`', if ``x.Equals(y)`' returns TRUE and ``y.Equals(z)`' returns TRUE, then ``x.Equals(z)`' should return TRUE.

> - It is consistent: for any reference values ``x`' and ``y`', multiple invocations of ``x.Equals(y)`' consistently return TRUE or consistently return FALSE, provided no information used in equals comparisons on the object is modified.

> - For any non-NIL reference value ``x`', ``x.Equals(NIL)`' should return FALSE.

> The ``Equals`' method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values ``x`' and ``y`', this method returns TRUE if and only if ``x`' and ``y`' refer to the same object (``x=y`' has the value TRUE).

> [Description inherited from Equals]

> Redefines: Equals, Equals

### GetSockAddr

    PROCEDURE (s: SocketInet) GetSockAddr(): SockAddr

> Return the socket address s, in the format expected by the functions of libc.

> [Description inherited from GetSockAddr]

> Redefines: GetSockAddr

### HashCode

    PROCEDURE (s: SocketInet) HashCode(): Hash

> Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary..

> The general contract of Object.HashCode is:

> - Whenever it is invoked on the same object more than once during an execution of an application, the Object.HashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.

> - If two objects are equal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce the same integer result.

> - It is not required that if two objects are unequal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of dictionaries.

> As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)

> [Description inherited from HashCode]

> Redefines: HashCode, HashCode

### ToString

    PROCEDURE (s: SocketInet) ToString(): STRING

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString, ToString

Class Detail: UnknownHostException

Type Detail

### Port

    TYPE Port = LONGINT

> Port number of an Internet host. A value in the range ``0..65335`'.

### SockAddr

    TYPE SockAddr = POINTER TO ARRAY OF CHAR

Variable Detail

### inet4Any

    VAR inet4Any-: Inet4

> Stands for "any incoming address" when binding to an address. This is the usual address in the host part of SocketInet to accept Internet connections on a server port.

### inet4Broadcast

    VAR inet4Broadcast-: Inet4

> The address to send a broadcast message.

### inet4Loopback

    VAR inet4Loopback-: Inet4

> The internet address ``127.0.0.1`' referring to this machine, typically called ``localhost`'.