Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. how to connect to GPRS and send data?

how to connect to GPRS and send data?

Scheduled Pinned Locked Moved Mobile
questionc++comsysadmintutorial
2 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    R Rajesh
    wrote on last edited by
    #1

    hi all, i am writing an application which needs to connect to the gprs network and send data(through web service). i have written the application in evc++, using AT commands ,i am able to initlialize ,attach gprs and dial(ATD*99***1#) and i get "CONNECT" as response. but after this stage how do i browse the internet or call my web service?? function which connects and attaches GPRS function code, void CTestGPRSCommandsDlg::OnModemOn() { BOOL bHangup = FALSE; CString strInit; CString res; //to hang up any ongoing calls while(!bHangup) { strInit = "+++"; Sleep(1000); port.Send(strInit); strInit = "ATH0\r"; Sleep(1000); res=OnSendAndWait(strInit); if(res=="OK") { bHangup=TRUE; } } strInit = "AT+CGATT=1\r"; //GPRS res=OnSendAndWait(strInit); AfxMessageBox(res); if(res!="OK") { AfxMessageBox(_T("GPRS Not Attached")); return ; } else { AfxMessageBox(_T("yahooooo GPRS Attached")); } strInit = "AT+CGDCONT=1,IP"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=1 Response = ") +res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "AT+CGDCONT=2,IP,\"airtelgprs.com\" ,0.0.0.0"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=2 Response = ") + res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "ATD*99***1#"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("ATD*99***1 Response = ") +res); if(res!="CONNECT") { AfxMessageBox(_T("Modem Not Initialized")); return; } AfxMessageBox(_T("Connected")); } my platform: EVC++ 3.0 pocketpc 2002 Device : intermec 760 with inbuilt GPRS modem.

    J 1 Reply Last reply
    0
    • R R Rajesh

      hi all, i am writing an application which needs to connect to the gprs network and send data(through web service). i have written the application in evc++, using AT commands ,i am able to initlialize ,attach gprs and dial(ATD*99***1#) and i get "CONNECT" as response. but after this stage how do i browse the internet or call my web service?? function which connects and attaches GPRS function code, void CTestGPRSCommandsDlg::OnModemOn() { BOOL bHangup = FALSE; CString strInit; CString res; //to hang up any ongoing calls while(!bHangup) { strInit = "+++"; Sleep(1000); port.Send(strInit); strInit = "ATH0\r"; Sleep(1000); res=OnSendAndWait(strInit); if(res=="OK") { bHangup=TRUE; } } strInit = "AT+CGATT=1\r"; //GPRS res=OnSendAndWait(strInit); AfxMessageBox(res); if(res!="OK") { AfxMessageBox(_T("GPRS Not Attached")); return ; } else { AfxMessageBox(_T("yahooooo GPRS Attached")); } strInit = "AT+CGDCONT=1,IP"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=1 Response = ") +res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "AT+CGDCONT=2,IP,\"airtelgprs.com\" ,0.0.0.0"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("AT+CGDCONT=2 Response = ") + res); if(res!="OK") { AfxMessageBox(_T("Modem Not Initialized")); return; } strInit = "ATD*99***1#"; res=OnSendAndWait(strInit); //AfxMessageBox(_T("ATD*99***1 Response = ") +res); if(res!="CONNECT") { AfxMessageBox(_T("Modem Not Initialized")); return; } AfxMessageBox(_T("Connected")); } my platform: EVC++ 3.0 pocketpc 2002 Device : intermec 760 with inbuilt GPRS modem.

      J Offline
      J Offline
      Joao Paulo Figueira
      wrote on last edited by
      #2

      R.Rajesh wrote: port.Send(strInit); This is too low-level. :eek: There are other options! ;) It is better for you to create a RAS connection and then use whatever protocol you need on top of the IP connection it will provide. If you want to be a bit more sophisticated, you can use the Connection Manager to arbitrate the connections for you (there is an MFC example in your PPC 2002 SDK). This way, you don't need to worry about the gory low-level details of making a connection. João Paulo

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups