IP lookup of localhost, ping IPs and use that to draw up a simple local network table
Posted on 2004-04-15
I was planning on using Java, but it wasn't quite working out for me, so I'm going back to what I'm a little more comfortable with, C++. Due to time restrictions, I'm not going to be making a GUI for it, or even making it look pretty, I just want something that'll work. I've never done any network programming in C++, so that's what brings me here. As of now, I'm looking to simply create a list of IPs (and possibly the names) of the computers connected to the same network (and subnet, not going outside of the subnet) as the computer running the program. I plan to do this by first having the program find the IP of the machine that's running the program, and then put that into a sort of formula to go through and ping each of the other possible IPs on the network. If a ping return is detected, it will add that to the list, if not, it will skip it and go on to the next IP to ping. I know it may not be the fastest way to do it, but I am on a class C network, and it also seems it will be the easiest to do (easier to accomplish the first time means I don't waste time trying to get a more complex solution working). I'm looking for anyone who could either give some code samples to take a look at, or refer to a resource that they feel may help out. I'd very greatly appreciate any help anyone can offer. Thank you!