
Extended Socket frames
Extended Socket example: TCP Listener
Digi XBee® 3 Cellular LTE-M/NB-IoT Global Smart Modem User Guide
173
Extended Socket example: TCP Listener
The following example demonstrates setting up a TCP listener on the XBee Cellular and interacting
with incoming connections. It will open up a listener socket on a given port and then receive data from
a client.
Note
The module must either have a public IP or a be on a private network in order to be accessible
as a server (listener).
Send a Socket Create frame
Note
The XBee Cellular does not support incoming TLS sockets.
Field
Value
Frame type
(Socket Create)
Frame ID
0x01
Protocol
0x01 (TCP)
Socket Create frame data:
7E 00 03 40 01 01 BD
Receive a Socket Create response
The response contains the socket ID assigned. This example assumes zero.
Field
Value
Frame type
(Socket Create Response)
Frame ID
0x01
Socket ID
0x00
Status
0x00 (Success)
Socket Create Response received from XBee:
7E 00 04 C0 01 00 00 3E
Designate the socket as a listener
The Socket Bind/Listen Frame takes the socket ID from the socket create response and a source port
that the socket will then listen on. In this example port 10001 is used.