How do you get the LAN IP addresses of all connected computers? (Multiplayer)

Okay, so far I know how to set up a simple UDP Multiplayer game. However, the problem lies with how I would get the IP addresses of other computers connected to my LAN without asking the owners of those computers to go to whatsmyip.com. So far I am still experimenting with sock stream and I am still just touching on the subject of setting up TCP servers. However, if you can offer help regarding this problem, then it is greatly appreciated.

You don’t have access to other clients’ IP addresses until they connect to your server (and the clients need to know the server’s address beforehand). After you’ve created a UDP socket and bound it to your external address, use the recvfrom method to get a (data, address) tuple from a client, where address is the (hostAdress, port) pair that you need to send to to talk back.

Note that if you’re behind a NAT, you’ll probably need to setup port forwarding on your router for them to be able to connect to you. If you’re on the same network as the clients though you should be fine.

Over LAN you can leverage multicasting to send data to all connections which could be used to mediate a connection, but this requires some additional thought.

Can TCP/IP be used over a local network?

Does this skip many of the issues with a wired network?

with a TCP/IP system could manage local and remote clients?

(Keep in mind I don’t know that much)

Sure it is a network protocol. It is used in networks.

The TCP/IP Protocol does not belong to the hardware layer. It is an hardware independent protocol.

BTW. what problems do you have with wired networks?

I was just thinking that it would be nice to have both local and remote managed by one system,

but this has nothing to do with the hardware. It is a matter of your setup and how you connect to the internet. You can connect to any terminal as long as it is reachable from your network access point.

There’s isn’t really a cross-platform way to do this so you’ll have to use one method for linux/mac? and another for windows. Pinging is one way to do it. Another way is ARP table through SNMP.

From Google search:
https://www.google.com/search?q=LAN+IP+addresses+of+all+connected+computers&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=rcs#channel=rcs&q=python+LAN+IP+addresses+of+all+connected+computers&rls=org.mozilla:en-US%3Aofficial




In the second link above, the first answer has a link to a ping implementation in python so you don’t need to use the OS ping or nmap:
http://www.g-loaded.eu/2009/10/30/python-ping/
If you determine the LAN IP of the computer, you still need to figure out the range to scan for. I think in general, the default range is 192.168.x.x.

BTW, stackoverflow is a good resource for programming questions.