[jcifs] threaded network crawler code examples (transport pro blem)

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Tue Jul 29 11:45:08 EST 2003


You're basically trying to create sockets to many servers that do not exist right? It takes a thread to open a socket. When the socket cannot establish a connection because the target host does not
exist that thread hangs for 1 min 15 sec. Right? Now you've knocked out that thread. So once you try to open a socket you're stuck. That's it. You just have to wait 1 min 15 sec. Now if you never
negotiate with a CIFS server during this, maxMpxCount will not be increased and will stay at 1 which will cause each thread to wait in line and proceed syncronously resulting in scanning 1 host every
1 min 15 sec.

Note now that this problem has nothing to do with maxMpxCount. Let's say I fixed this "problem" with maxMpxCount being static and it was allways initialized to say 10. Now 10 threads will be permitted
to open sockets to hosts that do not exist and you're now scanning a whopping 10 hosts every 1 min 15 sec. The net result is basically nothing considering it would take you several years to scan a
large network at either rate.

You cannot do nmap in Java. You simply cannot do what you want with jCIFS. You would need to write your program in C. IOW you simply cannot write a network scanner with Java.


More information about the jcifs mailing list