lwip-users
[Top][All Lists]
Advanced

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

Re: Re: [lwip-users] Problem with multi file sending http server


From: Mariusz Dz
Subject: Re: Re: [lwip-users] Problem with multi file sending http server
Date: Fri, 26 Nov 2010 15:56:19 +0100

Now the code is:

http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
        //variables

        hs = arg;

        if (err == ERR_OK && p != NULL)
        {
                if(hs->file == NULL)
                {
                        data = p->payload;
                        if (strncmp(data, "GET ", 4) == 0)
                        {

                                fresult_open = 1;

                                if (strncmp(data, "GET /css/style.css", 18)
== 0)
                                        {fresult_open = f_open
(&plik,"www/css/style.css", FA_READ);}
                                //and some more operation on files like
above, opening file to send

                                if(fresult_open == 0)
                                {
                                        fresult_read = f_read (&plik, dane,
10000, &zapisanych_bajtow);
                                        fresult = f_close (&plik);

                                        hs->file = wsk_dane;
                                        hs->left = zapisanych_bajtow;

                                        tcp_sent(pcb, http_sent);
                                        send_data(pcb, hs);
                                        tcp_output(pcb);

                                        tcp_recved(pcb, p->tot_len);
                                        pbuf_free(p);
                                }
                        }
                        else
                                {close_conn(pcb, hs);}
                }
                else
                        {pbuf_free(p);}
        }


//      if (err == ERR_OK && p == NULL)
//              {close_conn(pcb, hs);}
  
        return ERR_OK;
}

The end call close_conn  you mean the that if() is comment?


----------------------------------------------------------------
Wygraj notebooka w jesiennym konkursie!
Sprawdz >> http://linkint.pl/f2862




reply via email to

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