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: Sergio R. Caprile
Subject: Re: [lwip-users] Telnet - Raw API
Date: Mon, 6 Mar 2017 17:16:49 -0300
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.7.1

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.



reply via email to

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