EMBEDDED APPLICATIONS FCT
1
2
3
4
5
6
7
8
9
10
1
Define an appropriate PDP context according to
Service Provider data
Activate the required PDP context
Create a socket
For TCP only, perform a Connect to a remote host
Send data or status information over the socket to a
remote host
Receive data or status information over the socket
from a remote host
Repeat steps 5 and 6 for as long as the connection is
required
Once communications are complete, close the socket
Repeat steps 3 to 8 for communications with different
remote hosts
Deactivate the PDP context
2.2.4
TCP Connect Operations
A TCP connect operation can take quite a long time to
complete, depending upon the link performance, lost
packets etc. Therefore the tcpc() function has been made
non-blocking to avoid stalling the script for long periods.
A call to tcpc() will initiate a connection but return
immediately, leaving the lower level system to connect as
responses are received. If no connection is achieved
within a timeout of approximately 75 seconds, an
indication of the failure at the script level will occur when a
send or receive is attempted on a socket for which the
connection is not yet active. This means that the
application-writer should do one of two things to ensure
that send and receive operations do not fail because a
connection has not yet completed, either
Before a send or receive operation check the
connection status by using the
gtb(TCP_STATUS_BYTE) function and checking
against TCP_CONNECTED (where
LZT 123 8019 R1A
7