lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Telnet - Raw API


From: nrichard
Subject: Re: [lwip-users] Telnet - Raw API
Date: Mon, 6 Mar 2017 14:22:11 -0700 (MST)

Sergio R. Caprile wrote
> All you need is in the other apps, and the RFCs (for the telnet
> protocol...)
> 
> Once you get a pbuf, you basically get the data by reading each pbuf in 
> the chain, though there is a function to do that.
> 
> The easy way:
>          pbuf_copy_partial(p, buffer, p->tot_len, 0);
> 
> The hard, instructional way:
>          struct pbuf *q = p;
>          int offset=0;
>          while(q){
>                  memcpy(&buffer[offset],p->payload,p->len);
>                  offset += p->len;
>                  q = q->next;
>          }
> 
> Both "ways" put your data into your buffer, so you can do with that 
> whatever you please.
> 
> If you check the webserver, it even teaches you how to work with it 
> piece by piece.

That was the key part I was missing, copying it over to my own buffer.  I
was trying to use the pbuf->payload directly.  By copying it over to my own
buffer, I was then able to play with it how I wanted to.



--
View this message in context: 
http://lwip.100.n7.nabble.com/Telnet-Raw-API-tp28928p28941.html
Sent from the lwip-users mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]