Improvement for Webclient example possible?

Hi All,

Not sure if this is possible, but I noticed that the webclient.pde example does not work for hosts that run on a shared host. When I ping my website's address, I get an IP address. But if I enter that in my browser, I get a generic page from my webhost. It shares multple sites on that same IP address.

Is it possible to set an attribute or something to the client to indicate what website/host/domain is actually being requested? Or will this just not work on the example?

I did search for the mechanics of a http call and I read a lot, but I am sure I do not understand it well enough to make changes to the webclient example.

Can anybody point me in the right direction?

if you have many host with one IP probably you are under a NAT. the router has to be setted, that all incoming connection to your port has to be redirected to the host local IP.
every pc in lan has it's own local IP, and the can share one external IP. Host outside the lan cannot connect to a specific local IP, but this is a router work.
look for NAT, you won't find it looking for HTTP, because this is handled in the IP layer (cable -> ... -> IP -> TCP -> HTTP -> application)


GET /index.html HTTP/1.1

The “Host” header distinguishes between various DNS names sharing a single IP address, allowing name-based virtual hosting. While optional in HTTP/1.0, it is mandatory in HTTP/1.1

Hi sjfaustino,

thanks for you explanation. I had actually already used the Host header, and that didn't work. Looking at your suggestion, I realised i had put the Host header before the GET, which made all the difference.

Putting it after the GET resulted in the desired result!