Finding the computers on your network

Started by
4 comments, last by thooot 21 years, 11 months ago
Hi, I was wondering how I would go about getting a list of all the computers on my network. This way I can check to see if any of them is hosting a game without needing a central server. Also, I''m using Java for this, so could you either give Java code or give the general method of doing this (and hopefully I can convert that to Java). Thanks
Advertisement
Im looking for the same thing as him except in C/C++ (the altter preferably) if anyone can help us ;-)
Im looking for the same thing as him except in C/C++ (the altter preferably) if anyone can help us ;-)
~Alexei Andreyevitch Kozlenok~~ElectronicArts: RedWood Shores~
try looking into UDP broadcasting over a LAN. i don''t know much about it but involves sending a UDP messages to a mask instead of a single IP address, i think then you could just get a list of the IP addresses which reply to the broadcast and query them for game info
Thanks for hint Zanthos. I think that I''ve found a solution. If anyone wants to see it, there''s a tutorial at http://java.sun.com/docs/books/tutorial/networking/datagrams/index.html. I''m not sure if this will help you out Aselus, but you might want to check it out (even though it is Java) since you might be able to apply the principle to C++.
If i remember correctly, you send a (broadcast) udp datagram to the network address of your subnet. The network address of the subnet is *.*.*.0 where the *''s are your normal network addresses. For instance, if the computers on your network had addresses like 10.10.10.1, 10.10.10.2 etc. you would send to 10.10.10.0 . It''s either that or networks have a broadcast address on *.*.*.255 ... can''t remember which sorry!!!

This topic is closed to new replies.

Advertisement