GSM Shop GSM Shop
GSM-Forum  

Welcome to the GSM-Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features.
Only registered members may post questions, contact other members or search our database of over 8 million posts.

Registration is fast, simple and absolutely free so please - Click to REGISTER!

If you have any problems with the registration process or your account login, please contact contact us .

Go Back   GSM-Forum > Other Gsm/Mobile Related Forums > GSM Programming & Reverse Engineering


GSM Programming & Reverse Engineering Here you can post all Kind of GSM Programming and Reverse Engineering tools and Secrets.

Reply
 
LinkBack Thread Tools Display Modes
Old 11-04-2011, 08:16   #1 (permalink)
Junior Member
 
Join Date: Nov 2011
Location: On Earth
Posts: 1
Member: 1683250
Status: Offline
Thanks Meter: 0
GPRS connection


Hi,

I want to establish a simple HTTP connection from my PC to a remote server via GPRS, using the C code shown below. This libcurl code from libcurl - simple.c works fine when using ethernet connection, but when using GPRS it fails.
NOTE: -ttyS1 is the GSM modem attached to the PC
-the header file which define ttyS1 and write function is not shown

Code:
#include <stdio.h>
#include <curl/curl.h>
 
int main(void)
{
    CURL *curl;
    CURLcode res;
    int i=0;
     
    while(i<2)
    {
        write(ttyS1,"ATE0\r\n",strlen("ATE0\r\n"));//no echoeing
        sleep(1);
        write(ttyS1,"AT+CGATT?\r\n",strlen("AT+CGATT?\r\n"));
        sleep(1);
        write(ttyS1,"AT+CIFSR\r\n",strlen("AT+CIFSR\r\n"));
        sleep(1);
        write(ttyS1,"AT+CIPMODE=0\r\n",strlen("AT+CIPMODE=0\r\n"));
        sleep(1);
        write(ttyS1,"AT+CIPCSGP=1,\"MyISP\"\r\n",strlen("AT+CIPCSGP=1,\"ETL\"\r\n"));
        sleep(1);
        curl = curl_easy_init();
        if(curl) 
        {
             curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com");
                res = curl_easy_perform(curl);
         
                /* always cleanup */ 
                curl_easy_cleanup(curl);
        }
        i++;
    }
    write(ttyS1,"AT+CIPCLOSE\r\n",strlen("AT+CIPCLOSE\r\n"));
    sleep(1);
    return 0;
}
Can you help me on how I can establish a GPRS connection to a remote server using AT commands in a C code so that I can be able to test the connection by, for instance, pinging the remote server.

cheers
  Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting Dejan Flasher to Nokia 61xx gsmxc Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 2 01-07-2001 22:09
Connecting To Phone jscoulter Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 0 12-20-2000 11:03
How to use Nokia tool - with connection 6-7 pin or not?.. 2M Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 0 07-20-2000 19:53
WE OFFER cables for connection cellular-phones to the computers GLEBUS Main Sales Section 0 06-04-2000 19:05
Nokia Datasuite Connection Failure Judesp Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 0 12-27-1999 09:36

 



All times are GMT +1. The time now is 10:55.



Powered by Searchlight © 2024 Axivo Inc.
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -
Page generated in 0.12180 seconds with 10 queries

SEO by vBSEO