Server Discovery

Discussion about everything. New games, 3d math, development tips...
Post Reply
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Server Discovery

Post by sudi »

You all know this when u power up a network game u just have to hit a button and it searches for all the games running and displays them.
I tried to write my own network class. It works i can connect to other computers set up a server and send data and process it. But i dunno how to send a message to the whole network so i could send my server data back.
Any ideas?
Oh ofcourse i didn't write the network code...lol...would probably take me forever my class is a wrapper for enet which makes it really simple.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Many games use a public listing server for maintaining a list of active game sessions. When a host starts a session, it registers with the server. When a client wants a list of sessions, it connects to the listing server and requests a list of the registered servers.

You could also use socket multicasting or broadcasting to request a list of servers. I wouldn't recommend it, but it is something that you could do. Most likely the network library you are using won't support multicast or broadcast anyway, so that might stick you with doing a list server type implementation.

Travis
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Thanks vitek but already knew that....probably you got me wrong. I wanted to know how to do it on a private network and not internet. Because automatic server dicovery on lan is something a network class and ofcourse game should have.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

If that is the case, I still answered your question. You use broadcast or multicast. The servers listen for a broadcast/multicast message and then respond to it with the server information.

Travis
Halan
Posts: 447
Joined: Tue Oct 04, 2005 8:17 pm
Location: Germany, Freak City
Contact:

Post by Halan »

try zoidcom

www.zoidcom.com

it is simple (Event Receiver like usage) and has LAN broadcast
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

that defeats the point halan. i just wanted to have a light weight network class and not such a big system. and i guess zoidcom isn't for free.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
NicholasMag
Posts: 45
Joined: Fri Mar 09, 2007 8:06 pm

Post by NicholasMag »

zoidom is free....
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

vitek wrote:... I wouldn't recommend it, ...
Why is broadcasting that bad? And is there any better way, or is it like democracy, a bad solution but still the best we have at the moment?
If you don't have anything nice to say, don't say anything at all.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Broadcasting is the best way, and every network library should support broadcast, it's the simplest of all UDP/TCP/Multicast protocols. Multicast basically is broadcast, unless you are on a multicast aware network with multicast aware routers( otherwise switches/hubs just "broadcast" multicast to every computer on the network and it's up to the network device on the computer to know whether it's joined to a multicast group or not ).

I don't know ENET, or any of these other libraries, but if they happen to not support broadcast, I can supply you with REALLY simple code for opening a UDP Broadcast Tx socket and a UDP Broadcast Rx socket.
Image
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

oh man i don't really remember when i opend this thread.....
i tried to to what u said with the multicast but i couldn'T get it to work with enet.
so if u could lead me in the right direction i might be able to finish it off.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

For UDP or Multicast? Are you looking for code using ENET or just raw socket code?
Image
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

lol spintz is winding up to slap irrnet in yer face I think.

which doesn't have multicasting.

how did you do what you mentioned above spint with the Rxbroadcasting or whatever.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

IrrNet only uses Enet, doesn't it? I already stated I have no clue what the capabilities or usage of Enet is.

I have done network programming for over 6 years now, at my job, using Unicast UDP, Broadcast UDP, TCP, Multicast, MDP( Multicast Dissemination Protocol ), NORM( Nack Oriented Reliable Multicast ) and even PGM( which isn't yet implemented properly on Windows, but is the only OS which has implemented the Cisco RFC in Win XP SP2, Win Server 2003 and Vista ).

Anyways, Rx broadcast socket, is just a socket which is setup to receive broadcast data, on a specific port. Tx, is for transmit. Nowadays, with full-duplex connections to switches and routers, and even hubs pretty much standard, and with the speed of computers, you really don't need to multi-thread and have separate send and receive sockets on UDP, it's just what I'm used to.

Sudi, if you still need help, just PM me or email me.
Image
Post Reply