Extended Socket frames Extended Socket example: TCPListener
Digi XBee® 3 Cellular LTE Cat 1 AT&T Smart Modem User Guide
175
Extended Socket example: TCPListener
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
0x40 (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
0xC0 (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.