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

Properties

Supported Platforms

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

<0/off/false/1/on/true>

Default

0

Properties

Supported Platforms

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

Properties

Supported Platforms

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

Properties

Supported Platforms

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>

Default

60

Properties

Supported Platforms

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 #> - maximum number of TCP server clients, valid range: 0-8.

where:

0 is a deprecated value. If tcp.server.max_clients = 0 and bus.mode = command, then max TCP server clients = 8

Default

0

Properties

Supported Platforms

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

Properties

Supported Platforms

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

null

Properties

Supported Platforms

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 (used with auto_start option)

Arguments

<true/false>

Default

false

Properties

Supported Platforms

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

null

Properties

Supported Platforms

Get example

> get tc s k
R000012
mycert.key

Set example

> set tc s k mycert.key
R000008
Set OK

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

<0/1>

Default

0

Properties

Supported Platforms

Get example

> get tc s v
0

Set example

> set tc s v 1
Set OK