[cs631apue] Logging Remote IP address

bzhang41 bzhang41 at stevens.edu
Wed Nov 16 11:48:16 EST 2016


Dear Prof.

I have a question about the remote IP address.
I am trying to get the client's IP address, after I call the `accept`

  client_sock2 = accept(server_sock2,(struct sockaddr *)&client_name,
                                                         
&clientname_len);

But the IP address I got from the client_name.sin_addr is always 
0.0.0.0.

I run the server on the Linux lab.
And test it through my laptop browser (connect to the Stevens Wifi)
and through a desktop browser (connect to Stevens network use optical 
fiber),
they both have different IP address. But when they request the server as
different clients, I got the same IP address : 0.0.0.0.

Do you know why is that ? It quite strange to me.

Thanks
Bo


More information about the cs631apue mailing list