CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Connecting with GPRS

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
opvini



Joined: 27 Apr 2012
Posts: 50
Location: Brazil

View user's profile Send private message

Connecting with GPRS
PostPosted: Mon May 21, 2012 9:44 am     Reply with quote

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
Code:
AT+CIFSR


I receive my IP, for example
Code:
117.98.109.172


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

View user's profile Send private message

PostPosted: Tue May 22, 2012 3:27 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 22, 2012 7:05 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed May 23, 2012 4:36 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu May 24, 2012 11:44 pm     Reply with quote

is it possible? Work with server mode and client mode simultaneously?
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

PostPosted: Mon May 28, 2012 8:48 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group