# HTTP Server over PPP GPRS link

**URL:** <https://forums.digi.com/t/http-server-over-ppp-gprs-link/10785>\
**Category:** Rabbit\
**Created:** [May 2, 2008, 9:16pm UTC](https://forums.digi.com/t/http-server-over-ppp-gprs-link/10785 "2008-05-02T21:16:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rvertucci](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rvertucci](https://forums.digi.com/u/rvertucci)\
**Post date:** [May 2, 2008, 9:16pm UTC](https://forums.digi.com/t/http-server-over-ppp-gprs-link/10785/1 "2008-05-02T21:16:07Z")

</div>

I’ve written a simple progrm to test a RCM3600 based board connected to internet using Siemens MC35i GPRS Modem and Vodafone Italy as ISP

The PPP connection seems to start correctly but i’m not able to connect to HTTP server over internet.

The LOG of the program is:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

MODEM - Start Configuration

MODEM - ATV1

MODEM - ATE0

MODEM - AT+CGDCONT=1,“IP”,“web.omnitel.it”,“0.0.0.0”

MODEM - AT+CGATT=1

MODEM - AT+CGREG=0,1

PPP - Start Connection

PPPLINK: baud rate 115200: setting divisor to 5  
PPPLINK: bringing up serial PPP interface 0  
PPPLINK: baud rate 115200: setting divisor to 5  
PPPLINK: Opened PPP serial on iface 0 at 115200 baud  
CHAT: sending ‘ATDT_99_\*\*1#’  
PPPLINK: starting modem escape sequence  
PPPLINK: sendpacket totlen=1 i/f 0  
PPPLINK: sendpacket totlen=1 i/f 0  
PPPLINK: sendpacket totlen=1 i/f 0  
CHAT: expecting ‘CONNECT’  
PPPLINK: sendpacket totlen=14 i/f 0  
CHAT: found it!  
CHAT: end of script  
PPP: sending LCP config req i/f 0  
PPPLINK: sendpacket totlen=24 i/f 0  
PPP: got packet A7D0 on i/f:0 protocol:0xc021  
PPP: LCP NAK on i/f 0  
PPP: sending LCP config req i/f 0  
PPPLINK: sendpacket totlen=24 i/f 0  
PPP: got packet A7D0 on i/f:0 protocol:0xc021  
PPP: received LCP ACK i/f 0. local\_acked = 1  
PPP: got packet A7D0 on i/f:0 protocol:0xc021  
PPP: LCP config request i/f 0  
PPP: accepting option 2  
PPP: accepting option 7  
PPP: accepting option 8  
PPP: accepting option 5  
PPP: NAKing option 3  
PPP: sending LCP nak i/f 0  
PPPLINK: sendpacket totlen=13 i/f 0  
PPP: got packet A7D0 on i/f:0 protocol:0xc021  
PPP: LCP config request i/f 0  
PPP: accepting option 2  
PPP: accepting option 7  
PPP: accepting option 8  
PPP: accepting option 5  
PPP: accepting option 3  
PPP: sending LCP ack i/f 0  
PPPLINK: sendpacket totlen=28 i/f 0  
PPP: sending our credentials /  
PPP: sending PAP auth i/f 0  
PPPLINK: sendpacket totlen=10 i/f 0  
PPP: got packet A7D0 on i/f:0 protocol:0xc023  
PPP: sending IPCP config i/f 0  
PPPLINK: sendpacket totlen=26 i/f 0  
PPP: got packet A7D0 on i/f:0 protocol:0x8021  
PPP: IPCP config request i/f 0  
IPCP: peer wants IP addr C0A8FEFE  
PPP: accepting option 3  
PPP: sending IPCP ack i/f 0  
PPPLINK: sendpacket totlen=14 i/f 0  
PPP: sending IPCP config i/f 0  
PPPLINK: sendpacket totlen=26 i/f 0  
PPP: got packet A7D0 on i/f:0 protocol:0x8021  
PPP: IPCP NAK on i/f 0  
PPP: sending IPCP config i/f 0  
PPPLINK: sendpacket totlen=26 i/f 0  
PPP: got packet A7D0 on i/f:0 protocol:0x8021  
PPP: i/f 0 UP

PPP - Connection Established - IP Address = 91.80.89.19

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

When i try to connect to [http://91.80.89.19](http://91.80.89.19), i’ve no answer.

Can someone help me ???

In the following the program list.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#define PPP\_VERBOSE  
#define PPP\_DEBUG  
#define PPPLINK\_VERBOSE  
#define PPPLINK\_DEBUG  
#define CHAT\_VERBOSE  
#define CHAT\_DEBUG

#define HTTP\_VERBOSE  
#define HTTP\_DEBUG

// Serial Port Setting  
#define USE\_PPP\_SERIAL 0x04  
#define BAUD\_RATE 115200L

// TCP/IP Setting  
#define TCPCONFIG 0

#define TIMEZONE +2  
#define LCP\_TIMEOUT 5000

// GPRS Setting  
#define APN “web.omnitel.it”  
#define DIALUP\_NAME “”  
#define DIALUP\_PASSWORD “”  
#define DIALUP\_SENDEXPECT “ATDT_99_\*\*1# #CONNECT”  
#define DIALUP\_HANGUP “ATH #OK”

//-----------------------------------------------------------------

#memmap xmem

#use “eDAS\_SP.lib”  
#use “eDAS\_I2C.lib”  
#use “eDAS\_SPI.lib”  
#use “eDAS.lib”

#use “dcrtcp.lib”  
#use “http.lib”

//-----------------------------------------------------------------

#ximport “index.html” index\_html

const HttpType http\_types[] = {  
{ “.html”, “text/html”, NULL},  
{ “.gif”, “image/gif”, NULL}  
};

const HttpSpec http\_flashspec[] = {  
{ HTTPSPEC\_FILE, “/”, index\_html, NULL, 0, NULL, NULL},  
{ HTTPSPEC\_FILE, “/index.html”, index\_html, NULL, 0, NULL, NULL},  
};  
//-----------------------------------------------------------------  
int main() {

```
int Result, Counter, Length;
char Buffer[256];

BoardInit();

LedBlink(0);
LedOff(1);

BitWrPortI(PEDR,&amp;PEDRShadow, 1, 1);

//--------------------------------------------------------------

printf("

```

MODEM - Start Configuration

");

```
serCopen(BAUD_RATE);

sprintf(Buffer, "ATV1\r");
serCwrite(Buffer, strlen(Buffer));

Counter = 0;
while(1) {
  		while ((Result = serCgetc()) != -1) Buffer[Counter++] = (char)Result;
  		Buffer[Counter] = 0;
  		if (strstr(Buffer, "OK")) {
      		printf("

```

MODEM - ATV1

");  
break;  
}  
}

```
sprintf(Buffer, "ATE0\r");
serCwrite(Buffer, strlen(Buffer));

Counter = 0;
while(1) {
  		while ((Result = serCgetc()) != -1) Buffer[Counter++] = (char)Result;
  		Buffer[Counter] = 0;
  		if (strstr(Buffer, "OK")) {
      		printf("

```

MODEM - ATE0

");  
break;  
}  
}

```
sprintf(Buffer, "AT+CGDCONT=1,\"IP\",\"%s\",\"0.0.0.0\"\r", APN);
serCwrite(Buffer, strlen(Buffer));

Counter = 0;
while(1) {
  		while ((Result = serCgetc()) != -1) Buffer[Counter++] = (char)Result;
  		Buffer[Counter] = 0;
  		if (strstr(Buffer, "OK")) {
      		printf("

```

MODEM - AT+CGDCONT=1,"IP","%s","0.0.0.0"

", APN);  
break;  
}  
}

```
sprintf(Buffer, "AT+CGATT=1\r");
serCwrite(Buffer, strlen(Buffer));

Counter = 0;
while(1) {
  		while ((Result = serCgetc()) != -1) Buffer[Counter++] = (char)Result;
  		Buffer[Counter] = 0;
  		if (strstr(Buffer, "OK")) {
      		printf("

```

MODEM - AT+CGATT=1

");  
break;  
}  
}

```
sprintf(Buffer, "AT+CGREG?\r");
serCwrite(Buffer, strlen(Buffer));

Counter = 0;
while(1) {
  		while ((Result = serCgetc()) != -1) Buffer[Counter++] = (char)Result;
  		Buffer[Counter] = 0;
  		if (strstr(Buffer, "OK")) {
      		if (strstr(Buffer,"0,1")) {
	      		printf("

```

MODEM - AT+CGREG=0,1

“);  
break;  
}  
else if (strstr(Buffer,“0,5”)) {  
printf(”  
MODEM - AT+CGREG=0,5

");  
break;  
}  
}  
}

```
//--------------------------------------------------------------

printf("

```

PPP - Start Connection

");

```
sock_init();

ifconfig(IF_PPP2,
         IFS_PPP_INIT,
             IFS_PPP_SPEED, BAUD_RATE,
             IFS_PPP_FLOWCONTROL, 0,
             IFS_PPP_SENDEXPECT, DIALUP_SENDEXPECT,
             IFS_PPP_HANGUP, DIALUP_HANGUP,
             IFS_PPP_MODEMESCAPE, 1,
             IFS_PPP_ACCEPTIP, 1,
             IFS_PPP_ACCEPTDNS, 1,
             IFS_PPP_REMOTEAUTH, DIALUP_NAME, DIALUP_PASSWORD,
             IFS_UP,
             IFS_END);

while(ifpending(IF_PPP2) &amp; 0x1) tcp_tick(NULL);

//--------------------------------------------------------------

if (ifstatus(IF_PPP2)) {

  		printf("

```

PPP - Connection Established - IP Address = %s

", inet\_ntoa(Buffer, gethostid()));

```
	LedBlink(1);

  		http_init();
  		tcp_reserveport(80);

	while(1) {

 	   		if (ifstatus(IF_PPP2)) http_handler();
     		else break;

     		if (getchar() == 'x') break;
  		}

	//------------------------------------------------------

	printf("

```

PPP - Stop Connection

");

```
	LedOff(1);

	ifconfig(IF_PPP2, IFS_DOWN, IFS_END);
   	while(ifstatus(IF_PPP2)) tcp_tick(NULL);

	printf("

```

PPP - Connection Closed

");

```
	BitWrPortI(PEDR,&amp;PEDRShadow, 0, 1);

  		return(0);

}

//--------------------------------------------------------------

else {
  	LedOn(1);

	ifconfig(IF_PPP2, IFS_DOWN, IFS_END);
   	while(ifstatus(IF_PPP2)) tcp_tick(NULL);

	printf("

```

PPP - ERROR - Connection Failed

");

```
	BitWrPortI(PEDR,&amp;PEDRShadow, 0, 1);

  		return(-1);

}

//--------------------------------------------------------------

```

}

---

<div class="post-metadata">

**Author:** ![swamyp](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@swamyp](https://forums.digi.com/u/swamyp)\
**Post date:** [May 26, 2008, 11:47am UTC](https://forums.digi.com/t/http-server-over-ppp-gprs-link/10785/2 "2008-05-26T11:47:57Z")

</div>

hey i am also geting same problem .i was able to connect the ftp after the ppp connection and send the data .but i am not able to connect the http if u got the ans pls tell me how to resolve the problem
