User's Manual

Table Of Contents
Direct Socket Interface
AT+i Programmer‘s Manual Version 8.32 13-1
13 Direct Socket Interface
13.1 +iSTCP Open and Connect A TCP Socket
Syntax:
AT+iSTCP:<host>,<port>[,<lport>]
Opens a Transmission Control Protocol (TCP) client socket
and attempts to connect it to the specified <port> on a server
defined by <host>.
Parameters:
<host>
Logical name of the target server or a host IP address
<port>
0..65535, target port
<lport>
Optional local port on iChip
Command Options:
<host>
The server name may be any legal Internet server name that
can be resolved by iChip‘s DNS (Domain Name Server)
settings. The server name can also be specified as an absolute
IP address given in DOT form.
<port>
It is assumed that the server system is listening on the specified
port.
<lport>
Can be optionally specified to force iChip to use lport as the
local port when opening the TCP socket. If unspecified, iChip
allocates a port from its internal pool
1
.
Result Code:
I/<sock handle>
Upon successfully opening and connecting the TCP socket to
the <host>:<port>, a socket handle is returned. The socket
handle <sock handle> is in the range 0..9 and used to reference
the socket in all following socket commands.
I/ERROR
Otherwise
The Socket Command Abort may be used to abort prematurely.
1
Note: iChip uses the port range [1025 .. 2048] when assigning default local ports. The
host should refrain from specifying local ports in this range to ensure that Error 218 is not
generated as a result of requesting local ports that overlap internal assignments.