When I visited the website http://myipaddress.com/what-is-my-ip-address/
I checked the request header information. No where does it include my ip address. So how is the web server able to determine my ip address? I know that any web server has access to this information. But if its not there in the HTTP request, how do they get it?
You're connecting to the server and sending it an HTTP request. The server replies with a page. To do that, it has to know where to send the reply to. That information is automatically available from the socket connection (i.e. from a lower level than HTTP), so it doesn't have to be repeated in the request headers.
Edit:
If you want to know more about how the web server does this, see the accept function. When a connection comes in, the web server calls accept, which automatically provides it with the address of the other side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With