Extended Socket Example: Tcp Listener; Send A Socket Create Frame; Receive A Socket Create Response; Designate The Socket As A Listener - Digi XBee 3 Cellular LTE-M User Manual

Smart modem
Table of Contents

Advertisement

Extended Socket frames
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
Frame type
Frame ID
Protocol
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
Frame type
Frame ID
Socket ID
Status
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.
Digi XBee® 3 Cellular LTE-M/NB-IoT Global Smart Modem User Guide
Value
0x40
(Socket Create)
0x01
0x01 (TCP)
Value
0xC0
(Socket Create Response)
0x01
0x00
0x00 (Success)
Extended Socket example: TCP Listener
173

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xbee 3 cellular nb-iot

Table of Contents