Beginner: Unexplained network behavior

Mickael Remond <>
Fri Apr 23 18:12:06 CEST 2004


On Fri, 23 Apr 2004 11:23:03 -0400, Aaron Hunter <>  
wrote:

> Hello,
>
> A long time Java developer I recently discovered Erlang and am very  
> impressed. With a few improvements Erlang could very well be a J2EE  
> killer.

:-)

> I wrote this simple module to explore how sockets work in Erlang but am  
> puzzled by its behavior. It is supposed to scan 254 IP's simultaneously.  
> looking for HTTP servers. Over the course of several runs, however, it  
> gives me different answers and often misses HTTP servers.

Maybe this is because, it take more than five seconds to connect to the  
server ?
Did you try you program with an increased gen_tcp:connect/4 timeout ?
Is it more reliable when you use a timeout of 30 seconds ?

I think when scanning 254 addresses range at a time the network latency  
increases. Some server might answer slowly (5 seconds can sometime be very  
short).

> 	case gen_tcp:connect( IP, Port, [], 5000)  of
                                           ^^^^
                                  Try with 30000

I hope this helps.

-- 
Mickaël Rémond
  http://www.erlang-projects.org/



More information about the erlang-questions mailing list