Download AT Commands Manual
Transcript
AT Commands
User Manual
18.15 Write Socket Data +NSOWR
Command syntax
Base syntax
AT+NSOWR=<socket>,<l
ength>,<data>
Binary syntax
AT+NSOWR=<socket>,<l
ength>
Set base command
AT+NSOWR=3,16,”16
bytes of data”
Set binary command
AT+NSOWR=3,16
Description
This command writes the specified amount of data to the specified socket, like the BSD
write routine, and returns the number of bytes of data actually written. It can be applied to
UDP sockets too, after a Connect Socket command
There are two kinds of syntax:
- base syntax: useful for writing simple strings to the socket with the limitation that
a set of chars are forbidden;
- binary extended: mandatory for writing any char in the ASCII range [0x00, 0xFF],
it can be useful for sending protocol data bytes.
+NSOWR: 3,16
(Used syntax:
+NSOWR: <socket>,<length>)
OK
or
CME ERROR: <error>
@
(When this prompt appears, data are provided by the user, all the bytes in the range
[0x00,0xFF] can be accepted. After the specified <length> has been reached the response
can be:)
+NSOWR: 3,16
(Used syntax:
+NSOWR: <socket>,<length>)
OK
or
CME ERROR: <error>
For base syntax
<socket> is the socket identifier, in range 0-15.
<length> integer type value to specify amount of data to write, in range 0-512.
<data> string type of the data bytes to be written. Please note that not all of the ASCII charset can be used.
Allowed ASCII chars are:
0x20 (space), 0x21and from 0x23 to 0xFF. Substantially all of the alphanumeric set, symbols and extended
ASCII charset from 0x80 to 0xFF.
The control chars from 0x00 to 0x1F (included) are forbidden.
The 0x22 char, quotation marks ("), is forbiddent too.
Note: the value of <length> and the actual length of <data> should match.
For binary syntax
<socket> is the socket identifier, in range 0-15.
<length> integer type value to specify amount of data to write, in range 0-1024 (an extension, for the base
syntax it was 512).
After the command is provided, user waits for the @ prompt. When it appears the stream of bytes can be
provided. After the specified amount of bytes has been provided, system returns with OK (or ERROR). The
feed process cannot be interrupted i.e. the return in the command mode can be effective when the number of
bytes provided is the declared one. Please note: that specific feature of byte delivery is the only way for the
system to accept control chars as data; for the AT command specifications [2,3], chars like <CR>, <CTRL-Z>,
quotation marks, etc. have a specific meaning and they cannot be used like data in the command itself. The
command is so extended with a specific acceptance state identified by the @ prompt.
Note: this powerful feature can be successfully used when there is need to send a byte stream which belongs to
a protocol that has any kind of chars in the ASCII range [0x00,0xFF].
100