Forget about UDP packets

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
viruseb
Engineer
Engineer
Posts: 1
Joined: 03 May 2005 17:35

Forget about UDP packets

Post by viruseb »

In multi openttd checks a server with an udp packet and then connects to it with a tcp connection. The problem is if we want to tunnel the connection trought an ssh forwarding (and bypass my school firewall :) we can't cause ssh doesn't forward udp packets. What about a direct connection button who doesn't check the availability of the server ?
I've made a small hack in the source code just to remove the check of the availability of the server (by disabling the first if in NetworkGameWindowWndProc function in network_gui.c) so that the "join game" button is always enabled. Now I can connect to the server I want without relying on udp packet. The problem is that the game crashs when the server doesn't exist cause I guess there is no timeout on the tcp connection. So a button who directly connects to a server (in case of a ssh forwarding localhost) with a timeout will be perfect. This lead to an another question : Can we implement a timeout in the connect function ?
markr
Engineer
Engineer
Posts: 39
Joined: 05 Feb 2005 16:04

Post by markr »

There is a TCP connection timeout, but it is probably longer than you are prepared to wait.

This is actually a problem in standard openttd too because sometimes a server goes offline between when the game queries it and you connect.

Ideally it should use a nonblocking connect, and display some dialogue box with a cancel button.

Mark
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: Forget about UDP packets

Post by TrueBrain »

viruseb wrote:In multi openttd checks a server with an udp packet and then connects to it with a tcp connection. The problem is if we want to tunnel the connection trought an ssh forwarding (and bypass my school firewall :) we can't cause ssh doesn't forward udp packets. What about a direct connection button who doesn't check the availability of the server ?
I've made a small hack in the source code just to remove the check of the availability of the server (by disabling the first if in NetworkGameWindowWndProc function in network_gui.c) so that the "join game" button is always enabled. Now I can connect to the server I want without relying on udp packet. The problem is that the game crashs when the server doesn't exist cause I guess there is no timeout on the tcp connection. So a button who directly connects to a server (in case of a ssh forwarding localhost) with a timeout will be perfect. This lead to an another question : Can we implement a timeout in the connect function ?
The connect-timeout it set to the 90 seconds, I believe. So that is pretty long :p Mostly that is because nobody ever had problems with it... you can't connect if the server is offline because of the UDP check ;)

Anyway, you can always bypass the UDP-stuff by launching openttd with: '-n <ip>#<player>'.

The reason that we need this way, and can't bypass the UDP check ingame, is because of the TCP-connect-timeout. Because of the (bad) infrastructure of openttd, there is no good way to let the game wait in non-blocking for a connect, mostly because a user can decide to do other things and... f*** stuff up :) Anyway... if anyone has the time, he should try to make it nice and working :) Would be lovely!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 1 guest