Basic concepts of TCP/IP and PPP in GPRS applications

Source: Internet
Author: User

In fact, on gprs dtu, the protocol stack is TCP/IP Over PPP. We must have some corresponding concepts when using them. So Below we will give a brief description of some matters related to the use of SARO-1010P, if you want to learn more about these agreements, please refer to the relevant books:

1. dial ATD * 99*1 # For each SARO-1010P (or ATD * 99*1 #) after that, we are using the PPP protocol to shake hands with mobile access devices (generally a special GGSN router of a mobile company). When the PPP handshake succeeds, SARO-1010P gets a dynamic IP address. In general, every time the SARO-1010P goes offline (after hanging up the connection or directly after power-off) after re-dialing and PPP handshake obtained Dynamic IP addresses are not the same. However, mobile companies can activate specific APN and issue Special SIM cards for customers, so that the dynamic IP addresses obtained from this SIM card remain unchanged every time. That is to say, you can bind the SIM card to the IP address.

2. during the test, we should note the following fact: when using the Internet Apn ("cmnet, if we use SARO-1010P to actively initiate a TCP connection to a static public IP address on the public network, as long as the machine on the public network does have to listen on the corresponding port, this can be connected; but on the contrary, a TCP connection that is actively initiated from a public static IP address to an IP address dynamically obtained from the SARO-1010P will not succeed. The reason for this phenomenon is: in fact, the dynamic IP address obtained by the SARO-1010P is moving the address on a special intranet segment, the address in this special intranet segment if you want to and external network (Public Network) you must forward the TCP communication through a device similar to a TCP proxy (or NAT. In other words, this dynamic address is not accessible to other machines on the network.

3. The main function of the standard AT command + CGDCONT is to specify the Apn. Apn is short for Access Point Name (Access Point). Mobile provides Virtual Private Net (Vpn) services to industrial customers by activating special Apn. For example, if you want to access the Internet, you should use "cmnet" as the Apn. Another example is that an enterprise applied for the Vpn service from a mobile company, and the mobile company activated an Apn for it as "hxsw. then we should use this Apn to set the Gprs module. The format is as follows:
AT + CGDCONT = 1, "IP", "hxsw. gd"

4. determine that a TCP connection has four elements: the IP address of both parties and the TCP port number of both parties, that's why the SARO-1010P combines the local port, destination port, and destination IP address as the ID of the connection (the dynamic address that the SARO-1010P gets after the PPP handshake is successful does not change as long as the line is reconnected).

5. When using TCP for data communication, it must go through three stages. The first stage is the connection establishment stage, the second stage is the data transmission and receiving stage, and the third stage is the connection release stage:

1). Connection establishment phase:
The connection establishment involves both active and passive connections. Generally, the client initiates a connection and the server passively accepts the connection.

The so-called active connection means that the local party initiates a connection request to the remote end, and the passive connection means that the local party listens on a port, wait for the remote end and actively initiate a connection request to itself and respond, and finally shake hands to build the chain successfully.

After the connection is successful and switched to the data state, we can control the SARO-1010P through the OPEN command frame to actively connect. Of course, you must specify the IP address and port number of the other party during connection. As for passive connections, the SARO-1010P can also support, the current program only supports listening to one port. After the other party actively connects (SARO-1010P passive connection) will establish a new communication connection, the SARO-1010P will notify the successful event of this passive connection to the host computer.

2). Data sending and receiving phase:
After a connection is established, we can send and receive data on the connection.

We can use the SEND command frame to control the SARO-1010P for data sending. Of course, you must specify the connection number when sending the message (which is determined by the unique local port, destination address, and port ).

For the data sent by the other side, the SARO-1010P first stores it in its own data buffer, and then the data has reached this event notification to the host computer, the host computer reads the data has reached the event, the RECV command frame should be used in a timely manner to control the SARO-1010P to read all the data on the corresponding connection through the serial port, when the data is read, the original data occupied by the buffer space will be released. Note, because the data buffer of the SARO-1010P is limited (the total amount is only 25 K Bytes), so, for the data sent by the other party, the host computer must be read in time, otherwise the data accumulates more, this may cause data buffer overflow and data loss.

3). Hanging up the connection stage:
When all the data on a connection has been sent and received, the connection can be hung up.

Similar to the connection establishment phase, the link is also divided into active and passive.

We can use the RSET command frame to control the SARO-1010P for the active hanging of the connection.

If the connection is actively hung up by the other party, the SARO-1010P will notify the host machine to handle this event

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.