lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] http client end of conversation


From: address@hidden
Subject: Re: [lwip-users] http client end of conversation
Date: Tue, 25 Jun 2019 20:30:46 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

Am 24.06.2019 um 10:39 schrieb koszo.simon:
Hi,

I have just started to use http client application in lwIP 2.1.2. I use raw
API with #define NO_SYS 1.

I could successfully download 350 KB test file by calling the following
function:

httpc_get_file(&server_addr, portnum, pst->url, conn_settings_try,
HttpClientGetFileReceive, NULL, NULL);

The callback function looks like this:

err_t HttpClientGetFileReceive(void *arg, struct tcp_pcb* tpcb, struct pbuf
*p, err_t err) {
     if (p != NULL) {
         packet_cnt++;
         dprintf("packet_cnt: %u\n", packet_cnt);
         tcp_recved(tpcb, p->tot_len);
         pbuf_free(p);
     } else {
        dprintf("This is the end of the conversation\n");
     }
     return ERR_OK;
}

The dprintf function print debug messages on the serial port. I got the
counter values from 0 till 240. This fits to the number of the packets
observed in WireShark. However I haven't got the "This is the end of the
conversation" message.

How my application can notice if the tcp conversation with the http server
has been finished?

Well, this is a bit different, the client calls the 'result_fn' from the
'httpc_conntetion_t' struct when finished instead of calling the recv
function with a NULL pbuf. That might be a good idea, but it's not like
that currently.


Regards,
Simon



reply via email to

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