Further questions about LWIP/HTTP server
Stefan Kalkowski
stefan.kalkowski at ...1...
Mon Mar 1 12:17:58 CET 2010
On Monday, 1. March 2010 05:30:27 Peter Nguyen wrote:
> Hi,
Hi Peter,
>
> In digging to the HTTP server functionality, I noticed that with IP
> address, data is stored for local and remote IP addresses. I gather
> remote IPs refer to the machines making the requests. Does the local IP
> refer to the HTTP server itself??
Well, I'm not sure what code you refer to: the actual HTTP server example
code, or something in the LwIP libary? Moreover, I'm not sure, whether I got
you right.
If you talk about the HTTP server example code, there are 2 locations where
a 'sockaddr' is used, the one representing the address of the http server, so
to say the local IP (refering to the HTTP server):
libports/src/test/lwip/http_srv/main.cc:89
struct sockaddr_in in_addr;
in_addr.sin_family = AF_INET;
in_addr.sin_port = htons(80);
in_addr.sin_addr.s_addr = INADDR_ANY;
if(lwip_bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr))) {
...
and one which is used to accept client connections, that will contain the
address of the client, after a successful accept:
libports/src/test/lwip/http_srv/main.cc:106
struct sockaddr addr;
socklen_t len = sizeof(addr);
int client = lwip_accept(s, &addr, &len);
...
Does this clarify your question?
regards Stefan
PS: I refer to the example code of our last release 10.02
--
Stefan Kalkowski
Genode Labs Developer
http://genode-labs.com
More information about the users
mailing list