PDA

View Full Version : DirectPlay and searching for hosts



Sly
04-12-2002, 02:12 AM
Has anyone here used DirectPlay? I'm making some DirectPlay components for my own use and I found this interesting bit. If you enumerate hosts, you can optionally specify a host to search. Using '127.0.0.1' or 'localhost' will only search the local machine, for example. If you do not specify a host, then it does a broadcast over the LAN which should rightly include the local machine. But here's the catch. If you do not have a network cable plugged in, the search will not find the local server. Plug the network cable in to a hub and it will find the local server.

Just thought I'd share. :)

Zanthos
04-12-2002, 05:56 PM
With windows 2000 the network IP 192.168.0.40 (in my case) is not enabled until like you said, the Cat5 is connected to a hub. When you ask to search the LAN, you won't find the local machine which will DirectPlay will assume to be using your LAN IP, not the localhost.

In my game i'm using Winsock TCP for the data sending and UDP broadcast for locating games on the connected LAN. I'm also experimenting using a master server(nothing special, just my computer when I'm connected to the internet), to enable locating of master servers(works by querying a perl script located on tripod via HTTP :wink: ).

Useless Hacker
04-12-2002, 07:08 PM
I don't quite see how you could be attached to a network without having the cable plugged in.

TheLion
04-12-2002, 10:08 PM
You normally don't need a network cable to make your computer talk to itself using the loopback address. I think it's kind of odd, even for a microsoft machine! :)

Sly
05-12-2002, 08:45 AM
True, there is always a network present. It's called loopback and is represented by the address 'localhost' or 127.0.0.1.

I always thought TCP would be too slow for data transmission during gameplay. The guaranteed delivery of TCP would cause tremendous slowdowns when it has to request a resend of out-of-order or missing packets.

TheLion
05-12-2002, 09:01 AM
TCP is quite fast, I'm always amazed how fast we can deliver a single line text message over the internet these days.

I used TCP for my chessgame, however the data that had to be send over the socket was very tiny compared with other games, so that's not an honest comparison! :) I think TCP is fast enough to be used over a LAN, a lot of games seem to do it, although a lot of games seem to be using the IPX protocol too, dunno why. UDP is a nice and fast protocol, but you'll have to do some sort of CRC checking yourself to ensure that the package arrived the same way as it left the senders socket! :)

A plus of TCP packages is that they arrive in the same order (well they are placed in the correct order by a lower layer than the software layer I believe), however with UDP the packages can arrive in a random order and they aren't placed in the correct order by any network layer, so you'll have to solve that too and if a datagram is lost you'll have to re-request it too, but even then it's faster then TCP, due to the size of the datagram, only a lot more work to implement! :)

But knowing you, you knew at least half of this stuff allready! ;)

Sly
08-12-2002, 10:48 PM
Depending on the game type, you can usually drop packets and keep going because subsequent packets will make up for the missing packet. A fast-paced game such as a first-person shooter for example does not want to rely on TCP to get the packet order correct. The game should just ignore the out-of-order or dropped packets and continue on. A chess game however does not need minimum latency and can quite easily deal with the extra few milliseconds taken for TCP's guaranteed delivery.

I have found that not many games are using IPX these days. IPX was quite popular a couple of years ago for LAN games, but this popularity seems to be waning in favour of TCP/IP. DirectPlay and other alternatives such as HawkNL can povide guaranteed delivery using UDP, but they also can not get around the delays that guaranteed delivery may cause.

Kas
19-12-2004, 02:08 AM
You all seem very expeirenced in networking.

I have a simple question, that I cannot get answered.

I've been using the dxplay components for a while now, and how do I connect without having to type in the ip address in the pop up box?
Like when I call getSessions, it pops up a box to type the ip in. How can I create it so the Ip is hard coded in, or typed into an EditBox?

(It should be so simple, yet cannot figure it out)

Anonymous
22-12-2005, 02:41 AM
You all seem very expeirenced in networking.

I have a simple question, that I cannot get answered.

I've been using the dxplay components for a while now, and how do I connect without having to type in the ip address in the pop up box?
Like when I call getSessions, it pops up a box to type the ip in. How can I create it so the Ip is hard coded in, or typed into an EditBox?

(It should be so simple, yet cannot figure it out)

----------------------------------------------------------------

I'm trying to do the same thing...

Any code examples (for providing a DXPlay component with all of the
necessary parameters -in code- so none of the 'default' dialog boxes
pop up, would be greatly appreciated

Richard
richebbs@nildram.co.uk