-26-
v7.0
Software
3.11.4. Sending data
The
send()
function allows the user to send TCP/UDP packets once the socket is active. The function needs 2
different inputs parameters:
•
Socket ID
: the socket identifier used for opening the connection.
•
Data
: This is the stream of data to send to the TCP/UDP socket. This stream of data can be defined as a simple
string message. On the other hand, the data can be defined as an array of bytes, specifying a 3rd input for the
length of the array of bytes to send.
Example for sending a string message:
{
BG96.send(WaspBG96::CONNECTION_1, “This_is_the_data_payload”);
}
Example for sending an array of bytes:
{
uint8_t data[] = {0x31, 0x32, 0x33, 0x34, 0x35}
BG96.send(WaspBG96::CONNECTION_1, data, 6);
}
Possible error codes for this function:
1: if error checking socket status
2: if incorrect socket status
3: if error sending data
4: if error waiting confirmation from module
5: if error getting socket status
6: if timeout getting socket status
All examples related to TCP/UDP sockets (both client and server) show how to send data:
http://www.libelium.com/development/waspmote/examples/nb-iot-11-tcp-client
http://www.libelium.com/development/waspmote/examples/nb-iot-13-udp-client
Содержание Cat-M
Страница 1: ...NB IoT Cat M Module Networking Guide ...