SDL_net - SDLNet_TCP_Open and timeout

It would be nice if you could set the timeout for SDLNet_TCP_Open.

Currently it seems to timeout after a couple of minutes if you give it an
IP address it can’t reach, and until it times out it freezes your program.

James

James Gregory wrote:

It would be nice if you could set the timeout for SDLNet_TCP_Open.

Currently it seems to timeout after a couple of minutes if you give it an
IP address it can’t reach, and until it times out it freezes your program.

AFAIK, it is an OS wide setting, and it cannot be changed.
It would really be nice to have it though.–
Milan Babuskov
http://njam.sourceforge.net

James Gregory wrote:

It would be nice if you could set the timeout for SDLNet_TCP_Open.

Currently it seems to timeout after a couple of minutes if you give it an
IP address it can’t reach, and until it times out it freezes your program.

AFAIK, it is an OS wide setting, and it cannot be changed.
It would really be nice to have it though.

Hmm…oh well. What do commerical games do then? Do they always attempt to
open connections in a seperate thread from the main game to prevent the
game from freezing?

JamesOn Fri, 26 Mar 2004 18:19:06 +0100, Milan Babuskov wrote:

James Gregory wrote:

Hmm…oh well. What do commerical games do then? Do they always attempt to
open connections in a seperate thread from the main game to prevent the
game from freezing?

Use UDP. Most games don’t use TCP at all since it’s slower. If you still
wish to use TCP, use UDP at startup to check wheter the other box is
"there" and then start TCP connection.

BTW, most commercial games use DirectX, more specifically DirectPlay.
DirectPlay does all that transparently, you just have to specify want do
you want done, so you don’t have to worry about TCP, UDP, …

HTH–
Milan Babuskov
http://njam.sourceforge.net

James Gregory wrote:

Hmm…oh well. What do commerical games do then? Do they always attempt to
open connections in a seperate thread from the main game to prevent the
game from freezing?

Use UDP. Most games don’t use TCP at all since it’s slower.

My game is a bit unusual, and is actually better suited to TCP.

If you still
wish to use TCP, use UDP at startup to check wheter the other box is
"there" and then start TCP connection.

Hmm…that would be good, but I think it’s something that would be done
after everything else is finished, rather than something I’ll try to do
now.

BTW, most commercial
games use DirectX, more specifically DirectPlay.
DirectPlay does all that transparently, you just have to specify want do
you want done, so you don’t have to worry about TCP, UDP, …

I remember a few years ago DirectPlay was considered too slow by most
companies, I guess it must have improved since then. Still, I’m using
Linux nowadays, so unfortuantly not an option…

JamesOn Mon, 29 Mar 2004 16:11:31 +0200, Milan Babuskov wrote:

James Gregory wrote:

If you still
wish to use TCP, use UDP at startup to check wheter the other box is
"there" and then start TCP connection.

Hmm…that would be good, but I think it’s something that would be done
after everything else is finished, rather than something I’ll try to do
now.

Good idea.

I remember a few years ago DirectPlay was considered too slow by most
companies, I guess it must have improved since then. Still, I’m using
Linux nowadays, so unfortuantly not an option…

Somewhere in november/december 2003, someone proposed to add some code
to SDL_net that would allow us to use ICMP protocol, i.e. to ping. That
would be a perfect solution, but there were some issues that made it
unportable. There probably is a way to make it work on Linux/Mac, but
noone was interested/motivated enough to look into it. You can search
the messages archive and find the thread: “Plz review this new add to
SDL_net”

There you can find link to this website, where it is explained how to
reduce TCP the timeout in Windows:

http://www.tangentsoft.net/wskfaq/newbie.html#timeout

Unfortunately, that’s where the whole conversation stopped.–
Milan Babuskov
http://njam.sourceforge.net