[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Pulling data from a server using HTTP with lwIP
From: |
Robert Wood |
Subject: |
[lwip-users] Pulling data from a server using HTTP with lwIP |
Date: |
Thu, 13 Nov 2014 09:54:35 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
I'm getting started with lwIP; I have the SAM7X FreeRTOS demo running
and it is serving its demo file just fine.
However, what I really need to do is pull a file *from* a server. So,
I've created a new thread and done the following:
xNetConn = netconn_new ( NETCONN_TCP );
IP4_ADDR(&local_ip,emacIPADDR0,emacIPADDR1,emacIPADDR2,emacIPADDR3);
rc1 = netconn_bind ( xNetConn, &local_ip, 0 );
IP4_ADDR(&remote_ip,192,168,0,87);
rc2 = netconn_connect ( xNetConn, &remote_ip, 80 );
local_ip is the fixed address of my board, 192.168.0.87 is my desktop.
I've hooked up Wireshark to look at what's going on and I get two
packets (*): the lwIP SAM7X board sending out the initial request for a
connection with the SYN flag set and my desktop, which is running an
Apache server, replying with SYN & ACK flags set.
Now, I would expect the lwIP stack to then automatically return the
third packet in the handshake with just ACK flag set.
When the desktop sends out its SYN/ACK packet, I can see it goes through
a number of functions. It goes into ip_input(), you can see that the IP
addresses match and it calls tcp_input() which is happy that the ports
are correct and match. It clearly sees the flags are set to 0x12, which
is exactly what Wireshark says it is.
It ends up going into tcp_process(), in the switch statement for
pcb->state is goes into the SYN_SENT case, seems to increment the
sequence number correctly (I can see that number in the Wireshark data
and that gets incremented by one. Eventually, it goes into tcp_ack(),
which calls tcp_output(). pcb->flags is set to 0x01 which doesn't seem
right, but what is less right is that no packet gets sent out.
So, what vital step am I missing here? Is this something to do with
needing to specify a callback function and me sending out the
appropriate message? It looked to me like there was one set up; maybe it
was, just set-up and queued but not sent?
I only have a tenuous grasp callback functions, so it may be that I'm
missing something vital.
I have plenty of FreeRTOS experience, but this is my first foray into
lwIP. In truth, a lot of this is new; I talk about these flags like SYN
and ACK as if I know what I'm on about, but this is all new to me in the
past few days!
Many thanks. :~)
Rob
* Actually I get a few more - my desktop resending its last packet!
- [lwip-users] Pulling data from a server using HTTP with lwIP,
Robert Wood <=
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Robert Wood, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Simon Goldschmidt, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Robert Wood, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Simon Goldschmidt, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Robert Wood, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Simon Goldschmidt, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Robert Wood, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Simon Goldschmidt, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Robert Wood, 2014/11/13
- Re: [lwip-users] Pulling data from a server using HTTP with lwIP, Simon Goldschmidt, 2014/11/13