# Members

#### # inner SOCKET

socket mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`MODE.BINARY` | * | binary data stream
`MODE.ASCII` | * | ascii data stream
`MODE.CHKS` | * | use UDP checksum (default)
`MODE.NOCHK` | * | no UDP checksum
`MODE.NAGLE` | * | Nagle's algorithm
`MODE.NONAGLE` | * | don't use Nagle's algorithm
`TYPE.TCP_CLIENT` | * | tcp client socket
`TYPE.TCP_SERVER` | * | tcp server socket
`TYPE.UDP` | * | udp socket
`UDP.ANY` | * | receives any packet, outgoing packets are broadcast.
`UDP.FIRST` | * | No packets may be sent until a packet has been received. This first fills in the remote IP address and port number.
`SERVER.ANY` | * | TCP server socket bind address for any local ip address.

# Methods

#### # inner GetDomainname() → {string}

get the domain name.

Returns:
the domain name
Type: string

#### # inner GetHostname() → {string}

get the hostname.

Returns:
the hostname
Type: string

#### # inner GetLocalIpAddress() → {IpAddress}

get the local IP address.

Returns:
the local IP address as an array of numbers
Type: IpAddress

#### # inner GetNetworkMask() → {IpAddress}

get the netmask.

Returns:
the netmask as an array of numbers
Type: IpAddress

#### # inner http_get(url, head) → {HTTPResult}

do a HTTP GET request and return the answer as array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`url` | string | the URL to retrieve, must start with "http://".
`head` | Array.<string> | an array containing extra header fields and their values. Only fields defined in that array will be send with the request, no extra headers will be added.

Returns:
an array containing the HTTP response code, message, header (as string) and the response body (as an array of integer, one int per byte).
Type: HTTPResult

#### # inner http_headers(res) → {Object}

extract all response headers.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | HTTPResult | The array returned from http_get().

Returns:
a dictionary with header->value mapping or null if res was invalid.
Type: Object

#### # inner http_ok(res) → {bool}

check if a HTTP request succeeded.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | HTTPResult | The array returned from http_get().

Returns:
TRUE is the request returned code 200.
Type: bool

#### # inner http_string_content(res) → {string}

convert the data array returned by http_get() into a string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | HTTPResult | The array returned from http_get()

Returns:
a string or null if res was invalid.
Type: string

#### # inner Resolve(host) → {IpAddress}

look up a hostname in DNS.

##### Parameters:

Name | Type | Description
--- | --- | ---
`host` | string | the hostname.

Returns:
The IP address of the host or an exception.
Type: IpAddress

#### # inner ResolveIp(host) → {string}

reverse look up a host in DNS.

##### Parameters:

Name | Type | Description
--- | --- | ---
`host` | IpAddress | the ip address.

Returns:
The name of the host or an exception.
Type: string

#### # inner ServerSocket(host, lport) → {Socket}

create a server socket.

##### Parameters:

Name | Type | Description
--- | --- | ---
`host` | IpAddress | string | hostname/IP-address to bind to. SOCKET.SERVER.ANY to bind to 0.0.0.0
`lport` | number | local port to listen for incoming connections.

Returns:
A server socket.
Type: Socket

#### # inner Socket(host, rport, lportopt) → {Socket}

Create a TCP client socket (outgoing connection).

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`host` | IpAddress | string |  | IP or host name to connect to
`rport` | number |  | remote port.
`lport` | number | <optional> | local port.

Returns:
A TCP client socket.
Type: Socket

#### # inner UdpSocket(host, rport, lportopt) → {Socket}

Create a UDP socket.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`host` | IpAddress | string |  | IP or host name to receive from or one of SOCKET.UDP.
`rport` | number |  | remote port.
`lport` | number | <optional> | local port.

Returns:
An UDP socket.
Type: Socket

# Members

#### # inner SOCKET

socket mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`MODE.BINARY` | * | binary data stream
`MODE.ASCII` | * | ascii data stream
`MODE.CHKS` | * | use UDP checksum (default)
`MODE.NOCHK` | * | no UDP checksum
`MODE.NAGLE` | * | Nagle's algorithm
`MODE.NONAGLE` | * | don't use Nagle's algorithm
`TYPE.TCP_CLIENT` | * | tcp client socket
`TYPE.TCP_SERVER` | * | tcp server socket
`TYPE.UDP` | * | udp socket
`UDP.ANY` | * | receives any packet, outgoing packets are broadcast.
`UDP.FIRST` | * | No packets may be sent until a packet has been received. This first fills in the remote IP address and port number.
`SERVER.ANY` | * | TCP server socket bind address for any local ip address.

# Methods

#### # inner GetDomainname() → {string}

get the domain name.

Returns:
the domain name
Type: string

#### # inner GetHostname() → {string}

get the hostname.

Returns:
the hostname
Type: string

#### # inner GetLocalIpAddress() → {IpAddress}

get the local IP address.

Returns:
the local IP address as an array of numbers
Type: IpAddress

#### # inner GetNetworkMask() → {IpAddress}

get the netmask.

Returns:
the netmask as an array of numbers
Type: IpAddress

#### # inner http_get(url, head) → {HTTPResult}

do a HTTP GET request and return the answer as array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`url` | string | the URL to retrieve, must start with "http://".
`head` | Array.<string> | an array containing extra header fields and their values. Only fields defined in that array will be send with the request, no extra headers will be added.

Returns:
an array containing the HTTP response code, message, header (as string) and the response body (as an array of integer, one int per byte).
Type: HTTPResult

#### # inner http_headers(res) → {Object}

extract all response headers.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | HTTPResult | The array returned from http_get().

Returns:
a dictionary with header->value mapping or null if res was invalid.
Type: Object

#### # inner http_ok(res) → {bool}

check if a HTTP request succeeded.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | HTTPResult | The array returned from http_get().

Returns:
TRUE is the request returned code 200.
Type: bool

#### # inner http_string_content(res) → {string}

convert the data array returned by http_get() into a string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | HTTPResult | The array returned from http_get()

Returns:
a string or null if res was invalid.
Type: string

#### # inner Resolve(host) → {IpAddress}

look up a hostname in DNS.

##### Parameters:

Name | Type | Description
--- | --- | ---
`host` | string | the hostname.

Returns:
The IP address of the host or an exception.
Type: IpAddress

#### # inner ResolveIp(host) → {string}

reverse look up a host in DNS.

##### Parameters:

Name | Type | Description
--- | --- | ---
`host` | IpAddress | the ip address.

Returns:
The name of the host or an exception.
Type: string

#### # inner ServerSocket(host, lport) → {Socket}

create a server socket.

##### Parameters:

Name | Type | Description
--- | --- | ---
`host` | IpAddress | string | hostname/IP-address to bind to. SOCKET.SERVER.ANY to bind to 0.0.0.0
`lport` | number | local port to listen for incoming connections.

Returns:
A server socket.
Type: Socket

#### # inner Socket(host, rport, lportopt) → {Socket}

Create a TCP client socket (outgoing connection).

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`host` | IpAddress | string |  | IP or host name to connect to
`rport` | number |  | remote port.
`lport` | number | <optional> | local port.

Returns:
A TCP client socket.
Type: Socket

#### # inner UdpSocket(host, rport, lportopt) → {Socket}

Create a UDP socket.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`host` | IpAddress | string |  | IP or host name to receive from or one of SOCKET.UDP.
`rport` | number |  | remote port.
`lport` | number | <optional> | local port.

Returns:
An UDP socket.
Type: Socket