TCP Server

tcp.server.auto_interface

Abbreviation

tc s i

Access

get/set

Description

Wireless interface used for the TCP server if auto-start is enabled.
If set to default , uses the interface specified in network.default_interface .

Arguments

wlan/softap/default

Default

default

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s i
R000009
default

Set example

> set tc s i softap
R000008
Set OK

tcp.server.auto_start

Abbreviation

tc s a

Access

get/set

Description

Enable/disable TCP server auto-start on bootup.

Arguments

1|true|on/0|false|off

where

Default

0

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s a
R000003
0

Set example

> set tc s a true
R000008
Set OK

tcp.server.connected_gpio

Abbreviation

tc s c

Access

get/set

Description

The GPIO used to indicate whether a client is connected to the TCP server.

See also system.oob.gpio .

Arguments

<[GPIO#]/[-1]>

Default

-1

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s c
R000004
-1

Set example

> set tc s c 12
R000008
Set OK

tcp.server.data_gpio

Abbreviation

tc s d

Access

get/set

Description

The GPIO used to indicate whether a connected client has data available to read.
Note : Disable by setting to -1.

See also system.oob.gpio .

Arguments

<GPIO#>

Default

-1

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s d
R000004
-1

Set example

> set tc s d 13
R000008
Set OK

tcp.server.idle_timeout

Abbreviation

tc s t

Access

get/set

Description

Maximum client idle time in seconds before the client is automatically disconnected.

Setting tcp.server.idle_timeout to 0 turns off timeout completely: TCP server does not disconnect idle clients.

Arguments

<seconds>

Range: 0 - 65535

Default

60

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s t
R000004
60

Set example

> set tc s t 30
R000008
Set OK

tcp.server.max_clients

Abbreviation

tc s m

Access

get/set

Description

Specify maximum number of clients that may be simultaneously connected to the tcp server.

This variable applies only when bus.mode = command .

If bus.mode = stream , max TCP server clients = 1 .

Arguments

<max #>

where:

Default

0

Platforms

Properties

Gecko OS Plugin

Get example

> > get tc s m
0

Set example

> set tc s m 5
Set OK

tcp.server.port

Abbreviation

tc s p

Access

get/set

Description

TCP server port to listen on.

Arguments

<port>

Default

3000

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s p
R000006
3000

Set example

> set tc s p 3001
R000008
Set OK

tcp.server.tls_cert

Abbreviation

tc s n

Access

get/set

Description

The server TLS CA certificate filename.

Arguments

<filename>

Default

None

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s n
R000012
mycert.pem

Set example

> set tc s n mycert.pem
R000008
Set OK

tcp.server.tls_enabled

Abbreviation

tc s u

Access

get/set

Description

Enable server TLS certificate. This is used with the tcp.server.auto_start option.

Arguments

1|true|on/0|false|off

where

Default

False

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s u
R000003
0

Set example

> set tc s u false
R000008
Set OK

tcp.server.tls_key

Abbreviation

tc s k

Access

get/set

Description

The server TLS certificate key filename.

Arguments

<filename>

Default

None

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s k
R000012
mycert.key

Set example

> set tc s k mycert.key
R000008
Set OK

tcp.server.tls_peer_cert

Abbreviation

tc s e

Access

get/set

Description

This variable specifies the HTTP server's TLS client certificate chain.

In typical setups, there are two certificate chains:

Use tcp.server.tls_peer_cert to specify the client chain file, when it is different to the server chain file.

For details of creating certificates and chain files, see the HTTPS Intermediate Certificates example app .

Notes :

If tcp.server.tls_peer_cert is null then tcp.server.tls_cert is used for the client certificate chain. This is the legacy behavior.

To use this variable, set the variable tcp.server.tls_verify_peer to 1 .

Arguments

<cert_filename>

where:

Leave null to use tcp.server.tls_cert as the client certificate chain. To set the variable to null , set to the empty string:

set tcp.server.tls_peer_cert ""

Default

<null>

Platforms

Gecko OS Plugin

Example

set tcp.server.tls_peer_cert my_client_chain.pem

tcp.server.tls_verify_peer

Abbreviation

tc s v

Access

get/set

Description

When this variable is set, a connecting client must provide a valid TLS certificate that the server validates. The client is disconnected if the provided certifcate is invalid.

Note : The tcp.server.tls_cert variable must be set if using this feature.

Arguments

1|true|on/0|false|off

where

Default

0

Platforms

Properties

Gecko OS Plugin

Get example

> get tc s v
0

Set example

> set tc s v 1
Set OK