# http client over PPP skips request

**URL:** <https://forums.digi.com/t/http-client-over-ppp-skips-request/10654>\
**Category:** Rabbit\
**Created:** [November 1, 2011, 5:33pm UTC](https://forums.digi.com/t/http-client-over-ppp-skips-request/10654 "2011-11-01T17:33:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gjr.wss](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gjr.wss](https://forums.digi.com/u/gjr.wss)\
**Post date:** [November 1, 2011, 5:33pm UTC](https://forums.digi.com/t/http-client-over-ppp-skips-request/10654/1 "2011-11-01T17:33:13Z")

</div>

Hello,

I’m working on a project with a RCM3700, DC 9.62 and a wavecom fasttrack modem on serial D.

Approximately 6 out of 10 times I send a httpc\_get request it fails.  
In the logs it seems the only difference is the actual HTTP request is not being sent.

I’ve been looking for a solution for about two weeks now, I put all the httpc and modem code in a separate test program to exclude all other factors. Down to 250 lines of code and still the same problem. I hope someone can help me get back on track.

Besides extracting all the code I tried to replace these components:  
-SIM-card  
-Modem (about 6 different ones)  
-Rabbit  
-Rabbit-hold-board

All combinations gave the same errors, so i’m quite sure the problem lies in the software.

I have the following questions:  
1 - Is there any more debug info I can turn on, I have PPP, PPPLINK and CHAT + \_VERBOSE and IFS\_DEBUG = 6.  
2 - My predecessor had in the ifconfig for hangup “+++”. When i looked at the logging I noticed this gives 3 times “+++” on each up-down cycle. So I changed it to ATH, is this correct?  
3 - What am I doing wrong that it doesnt work 100% of the time?

Here is the outline of my program:

Configure modem with AT:  
-Reset modem (AT+CFUN=1)  
-Check flow control (AT+IFC? must return 0,0)  
-Check character framing (AT+ICF? must return 3,4)  
-Set pin  
-Set CGDCONT (AT+CGDCONT? must return 1,“IP”,“internet”)

When this is done I set up the IF\_PPP3

```auto
ifconfig(IF_PPP3, 
IFS_DEBUG, 6, 
IFS_PPP_SPEED, MODEM_SPEED, // = 38400L
IFS_PPP_RTSPIN, PCDR, NULL, 0, 
IFS_PPP_CTSPIN, PCDR, 1, 
IFS_PPP_FLOWCONTROL, 0, 
IFS_PPP_SENDEXPECT, "'ATD *99***1#\r' 'CONNECT 38400'", 
IFS_PPP_HANGUP, "ATH", 
IFS_PPP_MODEMESCAPE, 1, 
IFS_PPP_ACCEPTIP, 1, 
IFS_PPP_ACCEPTDNS, 1,
IFS_PPP_REMOTEAUTH, "username", "password", 
IFS_UP, 
IFS_END);

```

When the interface successfully came up I send the request:

```auto
err = httpc_init_if (&amp;hsock, &amp;tsock, IF_PPP3);
if (err) return err;

err = httpc_get(&amp;hsock, SERVER_IP_STR, SERVER_PORT, file, NULL);
if (err) return err;
   
err = httpc_skip_headers(&amp;hsock, 0);
if (err &lt; 0) return err; 

// read body and close connection

```

The last function call, httpc\_skip\_headers() is where it goes wrong.  
The function returns -1 with the socket error:  
Remote peer reset connection

A full piece of logging from a failed request:

```auto
PPPLINK: sendpacket totlen=45 i/f 0                                             
PPPLINK: sendpacket using 0000BCD8                                              
--- pkt flags=x40 i/f=0 tstamp=31512 len=45 ---                                 
  sect 1, len=45 addr=x80055A5A rlen=1481                                       
21 45 00 00 2C 00 06 00 00 40 06 32 CA 5E 9D 48 !E , @ 2 ^ H              
A9 52 CC 4D EA 04 01 CC DC 11 B8 00 00 00 00 00 R M                          
00 60 02 08 00 65 94 00 00 02 04 05 B4 ` e                        
PPPLINK: transmitter was idle                                                   
PPPLINK: receive processed 1 chars                                              
PPPLINK: receive processed 48 chars                                             
PPP: got packet BCD8 on i/f:0 protocol:0x21                                     
PPPLINK: sendpacket totlen=42 i/f 0                                             
PPPLINK: sendpacket using 0000BCA1                                              
--- pkt flags=x40 i/f=0 tstamp=15297 len=42 ---                                 
  sect 1, len=41 addr=x80055464 rlen=1485                                       
21 45 00 00 29 00 07 00 00 40 06 32 CC 5E 9D 48 !E ) @ 2 ^ H              
A9 52 CC 4D EA 04 01 CC DC 11 B8 00 01 01 91 05 R M                          
B5 50 18 08 00 2E F2 00 00 P .                        
  sect 2, len=1 addr=x00051C64 rlen=0                                           
47 G                             
PPPLINK: transmitter was idle                                                   
PPPLINK: receive processed 1 chars                                              
PPPLINK: receive processed 4 chars                                              
PPP: got packet BCD8 on i/f:0 protocol:0x21                                     
error -1 calling httpc_skip_headers()                                           
Socket error:Remote peer reset connection 

```

and finally a piece of logging from a successful request:

```auto
PPPLINK: sendpacket totlen=45 i/f 0                                             
PPPLINK: sendpacket using 0000BD0F                                              
--- pkt flags=x40 i/f=0 tstamp=5230 len=45 ---                                  
  sect 1, len=45 addr=x80056050 rlen=1481                                       
21 45 00 00 2C 00 01 00 00 40 06 C1 80 B2 E3 65 !E , @ e              
B1 52 CC 4D EA 04 00 CC DC FF 66 00 00 00 00 00 R M f                   
00 60 02 08 00 06 98 00 00 02 04 05 B4 `                            
PPPLINK: transmitter was idle                                                   
PPPLINK: receive processed 1 chars                                              
PPPLINK: receive processed 18 chars                                             
PPP: got packet BD0F on i/f:0 protocol:0x21                                     
PPPLINK: sendpacket totlen=133 i/f 0                                            
PPPLINK: sendpacket using 0000BCD8                                              
--- pkt flags=x40 i/f=0 tstamp=42230 len=133 ---                                
  sect 1, len=41 addr=x80055A5A rlen=1485                                       
21 45 00 00 84 00 02 00 00 40 06 C1 27 B2 E3 65 !E @ ' e              
B1 52 CC 4D EA 04 00 CC DC FF 66 00 01 8A BD D8 R M f                   
56 50 18 08 00 93 F4 00 00 VP                            
  sect 2, len=92 addr=x00051C64 rlen=0                                          
REQUEST PACKET CONTENTS                      
PPPLINK: transmitter was idle                                                   
PPPLINK: receive processed 1 chars                                              
PPPLINK: receive processed 100 chars                                            
PPPLINK: receive processed 112 chars                                            
PPP: got packet BD0F on i/f:0 protocol:0x21                                     
PPPLINK: receive processed 65 chars                                             
PPP: got packet BCD8 on i/f:0 protocol:0x21                                     
PPPLINK: sendpacket totlen=41 i/f 0                                             
PPPLINK: sendpacket using 0000BCA1                                              
--- pkt flags=x40 i/f=0 tstamp=42225 len=41 ---                                 
  sect 1, len=41 addr=x80055464 rlen=1485                                       
21 45 00 00 28 00 03 00 00 40 06 C1 82 B2 E3 65 !E ( @ e              
B1 52 CC 4D EA 04 00 CC DC FF 66 00 5D 8A BD D9 R M f ]                 
7D 50 10 06 EA BA C3 00 00 }P                            
PPPLINK: transmitter was idle                                                   
PPP: got packet BD0F on i/f:0 protocol:0x21                                     
PPPLINK: sendpacket totlen=41 i/f 0                                             
PPPLINK: sendpacket using 0000BCD8                                              
--- pkt flags=x40 i/f=0 tstamp=47277 len=41 ---                                 
  sect 1, len=41 addr=x80055A5A rlen=1485                                       
21 45 00 00 28 00 04 00 00 40 06 C1 81 B2 E3 65 !E ( @ e              
B1 52 CC 4D EA 04 00 CC DC FF 66 00 5D 8A BD D9 R M f ]                 
7E 50 10 06 EA BA C2 00 00 ~P                            
PPPLINK: transmitter was idle                                                   
PPPLINK: sendpacket totlen=41 i/f 0                                             
PPPLINK: sendpacket using 0000BD0F                                              
--- pkt flags=x40 i/f=0 tstamp=47288 len=41 ---                                 
  sect 1, len=41 addr=x80056050 rlen=1485                                       
21 45 00 00 28 00 05 00 00 40 06 C1 80 B2 E3 65 !E ( @ e              
B1 52 CC 4D EA 04 00 CC DC FF 66 00 5D 8A BD D9 R M f ]                 
7E 50 11 08 00 B9 AB 00 00 ~P                            
PPPLINK: transmitter was idle                                                   
PPPLINK: receive processed 1 chars                                              
PPPLINK: receive processed 45 chars                                             
PPP: got packet BD0F on i/f:0 protocol:0x21                                     
Return data: XML

```

Last but not least I tried playing around with the following timeout-defines, but without any luck:

```auto
#define DINBUFSIZE 255
#define DOUTBUFSIZE 255
#define URL_MAX_BUFFER_SIZE 1024
#define HTTP_MAX_BUFFER 1024
#define MAX_BUFFER_NET_SIZE 1024
#define MAXFORM_SIZE 64

#define TCP_OPENTIMEOUT 62000L // timeout for active opens
#define TCP_CONNTIMEOUT 26000L // timeout during open or close negotiation
#define TCP_SYNQTIMEOUT 180000L // timeout for pending connection
#define TCP_TWTIMEOUT 4000L

#define PSS_SENDBUF_SIZE 100

#define PPP_TIMEOUT 6000
#define CHAT_MAXLEN 60
#define CHAT_MAXSENDLEN 256

```

Hopefully someone is able to see whats going wrong here.  
Thanks for reading.

Kind regards,

Gert-Jan

edit 1 : typo  
edit 2 : Added concrete questions
