By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

Searching for computers on a LAN

P: n/a
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

Oct 29 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Brian Odsgaard" <ma**@oddball.remove.dkwrote in news:4907b56b$0$15899
$e*******@dtext01.news.tele.dk:
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

My guess is that you would perform a broadcast to all addresses on the LAN,
with a destination of a specific port # and with a specific known message
content.

Eligible servers would respond with some other known message.

You may get many responses, a single response, or no responses. You will
have to set a time limit on when the response can occur.

You may want to perform some additional negotation with or authentication of
the responding computers.

I haven't actually tried this, and I am interested in what others suggest or
have done.
Oct 29 '08 #2

P: n/a
On Wed, 29 Oct 2008 19:05:02 GMT, Ian Shef <in*****@avoiding.spam>
wrote:
>"Brian Odsgaard" <ma**@oddball.remove.dkwrote in news:4907b56b$0$15899
$e*******@dtext01.news.tele.dk:
>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


My guess is that you would perform a broadcast to all addresses on the LAN,
with a destination of a specific port # and with a specific known message
content.

Eligible servers would respond with some other known message.

You may get many responses, a single response, or no responses. You will
have to set a time limit on when the response can occur.

You may want to perform some additional negotation with or authentication of
the responding computers.

I haven't actually tried this, and I am interested in what others suggest or
have done.
For auto-discovery on a LAN -- using Java -- I think you will want
multicast sockets.

http://www.oser.org/~hp/ds/node27.html
Oct 30 '08 #3

P: n/a
I am still learning Java, but I had done it in C using socket. For Lan game,
I assume
that the program has both server and client. I am using multicast socket for
advertizing
the server on the Lan with a specific message(IP address and port for
Unicast); Before
starting the Multicast, the server has already started using Unicast socket.
The broadcast
message is sent every second or so. Once the client receives the broadcast
message,
it can use the IP and port to connect to the server. However, I had not
tried Multicast
only for actyual playing the game since every single message sent to
Multicast socket
will be recieved by other computer without loosing a bit. Since there is a
limited number of sockets
is allowed, using Multicast socket will allow more participants for the
game. The drawback
for this Multicast socket is that the computers outside the Lan can not
play.

"Ian Shef" <in*****@avoiding.spamwrote in message
news:Xn****************************@138.126.254.21 0...
"Brian Odsgaard" <ma**@oddball.remove.dkwrote in news:4907b56b$0$15899
$e*******@dtext01.news.tele.dk:
>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


My guess is that you would perform a broadcast to all addresses on the
LAN,
with a destination of a specific port # and with a specific known message
content.

Eligible servers would respond with some other known message.

You may get many responses, a single response, or no responses. You will
have to set a time limit on when the response can occur.

You may want to perform some additional negotation with or authentication
of
the responding computers.

I haven't actually tried this, and I am interested in what others suggest
or
have done.

Nov 14 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.