[erlang-questions] inets - http:request with invalid host

Per Hedeland per@REDACTED
Wed May 30 23:31:37 CEST 2007

"Sanjaya Vitharana" <sanjaya@REDACTED> wrote:
>Attached are the traces. But still I can't find why this happens.

Uh, why what happens, precisely? As far as I have understood (which
could of course be wrong), you are knowingly making a request to a
non-existent IP address? If so, you should of course expect it to fail.
The TCP/IP stack will give up - i.e. time out - the connect() operation
after a "pretty long time". Exactly how long depends on a lot factors,
too many to go into here - a bit over one minute is common, but it can
also be significantly more (or less).

Of course it could be argued that http:request/4 should pass the 8
second timeout that you give it onto gen_tcp:connect/4, instead of
calling gen_tcp:connect/3 which in your case (per above) proceeds to
hang for 3 minutes before it fails - and in the async case spawn the
gen_tcp:connect/4 instead of waiting for it to complete.

--Per Hedeland

More information about the erlang-questions mailing list