4 open the connection with the internet host – Rainbow Electronics GM862-QUAD-PY User Manual

Page 23

Advertising
background image





Easy GPRS User Guide

80000ST10028 Rev. 4 - 16/07/08

Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved

page 23 of 63

The response code to the AT#SGACT=1 command reports the IP address obtained from the network,
allowing the user to report it to his server or application.
Deactivating the context implies freeing the network resources previously allocated to the device.

NOTE: Also the command AT+CGACT activates a context, but in this case the context cannot be
used for Easy GPRS.

2.1.1.4 Open the connection with the internet host


With the AT command #SD (socket Dial) the TCP/UDP request to connect with the internet host starts:

• DNS query is done to resolve the IP address of the host name internet peer if required

• Telit module establishes a TCP/UDP (depending on the parameter request) connection with the

given internet host

• Once the connection is up the module reports the code: CONNECT


The command syntax is:

AT#SD = <Conn Id>,<Protocol>, <Remote Port>, <IP address> [, <Closure Type> [, <Local
Port>]]


Where:

Conn Id is the connection identifier.

Protocol is 0 for TCP and 1 for UDP.

Remote Port is the port of the remote machine.
IP address is the remote address.



To open the remote connection the context to which the Connection Id is associated must be active,
otherwise an error will appear.

For example if we want to connect to a web server with Connection Id number 3 the command is:

AT#SD = 3 , 0 , 80 , “www.telit.com”

If the command is successful we’ll have a CONNECT message, and the socket number 3 will be
connected to the Telit webserver.
From this moment the data incoming in the serial port is packet and sent to the Internet host, while the
data received from the host is serialised and flushed to the Terminal Equipment.
The +++ sequence does not close the socket, but only suspends it. We can suspend the connection
and open another one with a different Connection Id.
A typical command sequence is:

AT#SD = 3 , 0 , 80 , “www.telit.com”
CONNECT

Advertising