B4J Question Binding to one static IP

kostefar

Active Member
Licensed User
Longtime User
Dear All,

This is a client side question:

There´s a host on which I´m using httpjob.download from which the domain is not always resolved to the same IP. That´s completely normal.
As far as I can see, there are only two different IP´s that it resolves to.
However, one of these has a much better ping time response than the other one, so I was thinking that if I could bind my httpjob requests to this one, I´d get faster communication with the host. This host does not allow me to use the IP address directly neither in a browser nor in a httpjob request, it must go via the hostname.

I hope my question is clear. Any ideas?

Thanks in advance!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Two options:

1. If the server doesn't use SSL then you can override the host header:

B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("http://50.17.234.140/headers")
j.GetRequest.SetHeader("Host", "httpbin.org")
Wait For (j) JobDone (j As HttpJob)
Log(j.GetString)
j.Release

2. Configure the client computer to resolve the host name to a specific ip address (Windows: https://support.rackspace.com/how-to/modify-your-hosts-file/ )
 
Last edited:
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
Two options:

1. If the server doesn't use SSL then you can override the host header:

B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("http://50.17.234.140/headers")
j.GetRequest.SetHeader("Host", "httpbin.org")
Wait For (j) JobDone (j As HttpJob)
Log(j.GetString)
j.Release

2. Configure the client computer to resolve the host name to a specific ip address (Windows: https://support.rackspace.com/how-to/modify-your-hosts-file/ )

Big thanks!
 
Upvote 0
Top