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

Sanjaya Vitharana <>
Mon Jun 4 08:41:30 CEST 2007

Sorry I was not at my seat to reply this earlier.

> It seems as if the call to gen_tcp:connect fails with a lowlevel timeout
> (timeout in the inet driver not controlled by the inets application),
> this  would  explain why
> the asynchronous call takes longer time, as the result of the
> asynchronous calls
Yes, that seams the case.

I have reproduce the gen_tcp:connect in  http_transport.erl to get the time
for that request. The time values for gen_tcp:connect and http:request
(Asynchronous) aproximately same.

So my argument is,
Asynchronous request should return immediately and whatever the results
(reply/error OR timeout) received should return later rather than hanging at
that possition.  Am I wrong ?

Follow up the attached test with below reqults.


1> c(connecttest).
2> connecttest:test_url().
 Time for gen_tcp:connect request 189017815 microseconds ConnectRes={error,

 Time for Asynchronous request 189033609 microseconds ResASync={ok,

3> q().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: connecttest.erl
Type: application/octet-stream
Size: 990 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070604/8cf69fb5/attachment.obj>

More information about the erlang-questions mailing list