User's Manual

Table Of Contents
Direct Socket Interface
AT+i Programmer‘s Manual Version 8.32 13-9
13.8 +iSRCV Receive A Byte Stream from A Socket’s Input
Buffer
Syntax:
AT+iSRCV:<hn>[,<max>]
Receives a byte stream from the TCP/UDP socket
specified by the socket handle hn. Received data is
valid only if it already resides in iChip‘s socket input
buffer at the time this command is issued.
Parameters:
<hn>
A TCP/UDP socket handle of an open socket
<max>
Optionally specifies the maximum number of bytes to
transfer. Additional bytes may remain in the socket
input buffer following this command.
Command Options:
<hn>
Must have been obtained by a previous execution of an
AT+iSTCP or AT+iSUDP command during the
current Internet mode session. Or a socket accepted by
a listening socket.
<max>
If <max> is not specified, all available bytes residing
in the socket input buffer are returned.
Returns:
I/<sz>[:<stream>][<checksum>]
where,
sz is the exact size of the binary data stream to follow.
If the socket input buffer is empty, iChip returns
I/O<CR><LF>. In this case, stream is omitted.
sz is guaranteed to be equal or less-than max, when
specified.
checksum is a two-byte checksum. This parameter is
calculated by iChip only when it is in checksum mode
(CKSM set to ‗1‘). checksum is calculated by
summing all the characters in stream modulo 65536
and taking two‘s complement of the result. checksum
is sent as big-endian. The host application is assumed
to calculate its own checksum upon receipt of stream
and compare it against the checksum bytes received
from iChip. If the two checksums don‘t match, the
host can issue an AT+i!SRCV command, which
causes iChip to re-transmit the data. The next
AT+iSRCV command that the host issues causes
iChip to dump all data transmitted to host in the
previous AT+iSRCV command.