View previous topic :: View next topic |
Author |
Message |
opvini
Joined: 27 Apr 2012 Posts: 50 Location: Brazil
|
Connecting with GPRS |
Posted: Mon May 21, 2012 9:44 am |
|
|
Hi,
I have a GSM module (SIM340), and I need to connect my PIC18F4520 with GPRS to send data (to my web-server) and to RECEIVE data (from my web-server using sockets), like a server.
Well, I can send SMS, receive SMS, receive call and I can send data with GPRS, but I can't receive.
I am using the AT commands to connect and send data, like bellow:
Code: |
AT+CGATT=1
AT+CGDCONT=1,"IP","gprs.oi.com.br"
AT+CDNSCFG="200.222.108.241"
AT+CSTT="gprs.oi.com.br","oiwap","oioioi"
AT+CIICR
AT+CLPORT="TCP","8080"
AT+SERVER
AT+CIPHEAD=1
AT+CDNSORIP=1
AT+CIPSTART="TCP","www.vinicius.info","80"
AT+CIPSEND
>GET /gprs/ HTTP/1.1
>Accept: */*
>Accept: text/html
>
>
|
But when I try
I receive my IP, for example
But when I try connect with 117.98.109.172:8080 it doesn't work.
Thanks!!! |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue May 22, 2012 3:27 am |
|
|
Most likely the problem is with your cellular provider.
As I understand from your device you can setup a data connection to any address on the internet? This is called a Mobile Originated service. What you are looking for is a service called Mobile Terminated.
Your cellular provider has only a limited number of IP-addresses and will use NAT (Network Address Translation) to make the connection from your mobile to the internet. Setting up a connection in the other direction, from internet to your mobile, won't work because the required entry in the NAT is missing.
The solution is to ask your cellular provider for a wireless plan (APN) that supports Mobile Terminated Data. In such a plan your mobile will be designated a fixed IP-address (and no NAT is required anymore) or you will be given a range of TCP-ports (added as static routes to the NAT). |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Tue May 22, 2012 7:05 am |
|
|
If you receive an IP, 117.98.109.172 in your example, you are already connect, so What do you mean with you can't connect?
I'm curious, Why do you choose Server mode from SIM340?
As I understand the server mode is to wait a connection from anybody who send data to the designated port, not to start one.
If you need to connect to one web address I think that you must to use Client mode.
In Client mode you can connect from one to several IP address. _________________ Electric Blue |
|
|
opvini
Joined: 27 Apr 2012 Posts: 50 Location: Brazil
|
|
Posted: Wed May 23, 2012 4:36 pm |
|
|
Hi, thanks for reply.
Well, I need work with the client mode and the server mode, becouse I need to send data from time to time, for example with a period of 5s, and, simultaneously I need to listen one port to receive data anytime from others... |
|
|
opvini
Joined: 27 Apr 2012 Posts: 50 Location: Brazil
|
|
Posted: Thu May 24, 2012 11:44 pm |
|
|
is it possible? Work with server mode and client mode simultaneously? |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Mon May 28, 2012 8:48 am |
|
|
I think not.
You must choose one of them.
I don't remember about SIM340 but in SIM900 it exist something called MUX MODE.
In that mode you can be a client connected to several IPs at same time.
Read the datasheet, may be it help you. _________________ Electric Blue |
|
|
|