开发者

Wavecom GSM modem as a TCP client

开发者 https://www.devze.com 2022-12-08 09:40 出处:网络
I\'ve been trying to do TCP communication using my Wavecom Fastrack modem. What I want to achieve is make the modem connect to a specified TCP server port to enable me to transfer data to and from the

I've been trying to do TCP communication using my Wavecom Fastrack modem. What I want to achieve is make the modem connect to a specified TCP server port to enable me to transfer data to and from the server. I found some information on than in the user's guide. Basing on the information you can find on page 66 I created an application that opens the serial port to which the modem is connected and writes the following AT commands:

AT+WIPCFG=1 //start IP stack
AT+WIPBR=1,6 //open GPRS bearer
AT+WIPBR=2,6,11,"APN" //set APN of GPRS bearer
AT+WIPBR=2,6,0 //username
AT+WIPBR=2,6,1 //password
AT+WIPBR=4,6,0 //start GPRS bearer

AT+WIPCREATE=2,1,"server_ip_address",server_port //create a TCP client on port "server_port"

AT+WIPDATA=2,1,1 //switch do data exchange mode

This is exactly what the user's guide says. After the last command is sent to the modem, the device switches to data exchange mode and from then on everything what is written to the seria开发者_如何学JAVAl port opened by my application should be received by the server and everything the server sends should appear in the input buffer of that port.

The thing is that I did not manage to maintain stable bidirectional communication between the server and my modem. When I write some data to the serial port (only a few bytes), it takes a lot of time before the data appears on the server's side and in many cases the data does not reach the server at all.

I performed a few tests writing about 100 bytes to the serial port at once. Logging the data received by my server application I noticed that the first piece of data (8-35 bytes) is received after a second or two. The rest of the data appears in 2-5 seconds (either as a whole or in pieces of the said size) or does not appear at all.

I do not know where to look for the reason of that behaviour. Did I use wrong AT commands to switch the modem to TCP client mode? I can't believe the communication may be so slow and unstable.

Any advice will be appreciated. Thank you in advance.


what OS are you running? Windows does a pretty good job of hiding the messy details of communicating with the GPRS modem, all you have to do is create a new dial-up connection. To establish the connection you can make a call to the Win32 RasDial function. Once connected, you can use standard sockets to transfer data on a TCP port.


i have been using wavecomm modem for 2 years now.As far as i know from my experience is that if you are able to send some of the data then you can send all of the data.

the problem might be in the listening application which receives the data on the server side. It could be that it is unable to deal with the amount of data that you are trying to send.

try sending the same data in smaller busts with some delay in between them,then you might receive all data intact.

0

精彩评论

暂无评论...
验证码 换一张
取 消