# 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 CurlExtractHeaders(res) → {Object}

extract all response headers.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | `CurlResult` | The array returned from Curl.DoRequest().

See:
  - Curl

Returns:

a dictionary with header->value mapping.

Type: `Object`

#### # 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}

##### 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.

Deprecated:
  - use Curl() instead! do a HTTP GET request and return the answer as array.
See:
  - Curl

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}

##### Parameters:

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

Deprecated:
  - use Curl() instead! extract all response headers.
See:
  - Curl

Returns:

a dictionary with header->value mapping or null if res was invalid.

Type: `Object`

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

##### Parameters:

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

Deprecated:
  - use Curl() instead! check if a HTTP request succeeded.
See:
  - Curl

Returns:

TRUE is the request returned code 200.

Type: `bool`

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

##### Parameters:

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

Deprecated:
  - use Curl() instead! convert the data array returned by http_get() into a string.
See:
  - Curl

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(ip) → {string}

reverse look up a host in DNS.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ip` | `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`

#### # inner urldecode(str) → {string}

URL decode a string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | `string` | encoded string

Returns:

decoded string.

Type: `string`

#### # inner urlencode(str) → {string}

URL encode a string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | `string` | decoded string

Returns:

encoded string.

Type: `string`

# 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 CurlExtractHeaders(res) → {Object}

extract all response headers.

##### Parameters:

Name | Type | Description
--- | --- | ---
`res` | `CurlResult` | The array returned from Curl.DoRequest().

See:
  - Curl

Returns:

a dictionary with header->value mapping.

Type: `Object`

#### # 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}

##### 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.

Deprecated:
  - use Curl() instead! do a HTTP GET request and return the answer as array.
See:
  - Curl

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}

##### Parameters:

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

Deprecated:
  - use Curl() instead! extract all response headers.
See:
  - Curl

Returns:

a dictionary with header->value mapping or null if res was invalid.

Type: `Object`

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

##### Parameters:

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

Deprecated:
  - use Curl() instead! check if a HTTP request succeeded.
See:
  - Curl

Returns:

TRUE is the request returned code 200.

Type: `bool`

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

##### Parameters:

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

Deprecated:
  - use Curl() instead! convert the data array returned by http_get() into a string.
See:
  - Curl

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(ip) → {string}

reverse look up a host in DNS.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ip` | `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`

#### # inner urldecode(str) → {string}

URL decode a string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | `string` | encoded string

Returns:

decoded string.

Type: `string`

#### # inner urlencode(str) → {string}

URL encode a string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | `string` | decoded string

Returns:

encoded string.

Type: `string`