I have posted this question in other topics here but have had no luck. So, does anyone here know if its even possible for a Pure Java application, using TCP/IP to snoop out and find the other computers on a company LAN. I am not talking about anything fancy here, like finding computers on a company WAN, A company global wide netwok etc... I just want to be able to find the other machines on a local LAN. Is there a limitation in JAVA for this? I was thinking about using JNDI but even that seems to fall short. Please help. Thank You.
So, does anyone here know if its even possible for a Pure Java application, using TCP/IP to snoop out and find the other computers on a company LAN.
Well, that depends on several things. I'm not sure that there is a 100% guaranteed way to enumerate all the machines on a LAN, but there are methods you could try. The best approach is to utilize a ping sweep. Now, without native code or running an external process like fping and capturing and parsing the output, you can't do that in Java because ICMP echo packets have to be sent over raw sockets. Another approach is to scan known ports on the LAN's subnet, eg ports 137-139 for Windows netsesion or some flavor of Unix running Samba, any machine on which you get an exception on you assume does not exist. The main problem with this is some or all machines on the LAN may have these ports closed for security reasons. Even the ping sweep may not work if there is packet filtering software like ZoneAlarm installed on some or all of the machines. There is a Java extension named JPcap with which you could code your own Java ping sweeper. It is a small package and seems to work OK but the documentation is attrocious. So you'll need a fair understanding of network protocols to use it effectively. You can get it here: JPCap If your machine is a Windows box, then you will also need WinPcap. You can get that here: WinPcap Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joined: Oct 27, 2002
Micheal, Thank you so VERY much for this response. It is very informative and I am sure will go a long way in helping me succeeding with this next project.