RAK411 PROGRAMMING MANUAL
V1.7
COPYRIGHT ©
SHENZHEN RAKWIRELESS TECHNOLOGY CO., LTD
ETDX1603021415
36
Description:
Module as a TCP server and create a listening port, if the operation is successful, the
module will return a hexadecimal identifier (Socket ID), is used to manage the connection.
Establish a TCP server can connect up to seven clients. Establish a TCP server on a different
port, allows you to create up to four. Close TCP server identifier to connect to the TCP sever
the client connection will be closed.
Return Value:
Parameter
Bytes
Value
Description
<CODE>
2
0xB4,0x00
Response Code
<SOCKET_FLAG>
2
8--11
Socket identifier
<STATUS>
1
0
Command successful
-2
Failed to create
-3
Failed to bind
-4
Target port connection
error
4.3.2 TCP Client
Command:
rak_tcp_client
Syntax:
typedef struct {
uint32_t cmd;
uint32_t dest_addr;
uint16_t dest_port;
uint16_t local_port;
}rak_client_t;
Parameter:
Parameter
Bytes
Value
Description
cmd
4
0xB3,0x00,0x00,0x00
Command Code
dest_addr
4
Target IP address
dest_port
2
1-65535
Target port number