Finding computers on LAN

B

Brian Odsgaard

Hi all

I'm going to build a simple multiplayer game.

The task is to create a game that runs on multiple computers on a LAN.

I want to create a solution that don't need a server running on a specific
computer with a specific IP - all computers should be able to initiate a
game and act as server.

How can I make an application search the LAN to find if any connected
computers is running as server - without knowing the IP on the other
computers?

- Brian
 
A

Arne Vajhøj

Brian said:
I'm going to build a simple multiplayer game.

The task is to create a game that runs on multiple computers on a LAN.

I want to create a solution that don't need a server running on a
specific computer with a specific IP - all computers should be able to
initiate a game and act as server.

How can I make an application search the LAN to find if any connected
computers is running as server - without knowing the IP on the other
computers?

One idea:
java.net.DatagramSocket and UDP broadcast

Arne
 
R

Roedy Green

How can I make an application search the LAN to find if any connected
computers is running as server - without knowing the IP on the other
computers?

I think you will need to learn to solve the problem for your
particular OS in C++ and write some JNI.
 
J

John B. Matthews

Christian said:
I don't think that helps. These protocols are rather for
creating/distributing IP addresses not building up connections.

Thank you for expanding on this. I was thinking of the DNS based Service
Discovery capability:

The UDP multicast really is the way to go in LAN.

Bonjour (a zeroconf implementation) uses multicast on UDP port 5353. I
use it to find local print- and vnc-servers:

<http://en.wikipedia.org/wiki/Bonjour_(software)>

I'm told it can find games:

[...] it won't work in WAN ;-)

Thank goodness!
 
A

Arne Vajhøj

Roedy said:
I think you will need to learn to solve the problem for your
particular OS in C++ and write some JNI.

Why ?

Other posters have already posted Java solutions.

Arne
 
B

Brian Odsgaard

Hi again ...

Thanks for all the suggestions - I'll have a look into them and hope to find
what I'm looking for :)

- Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top