News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Better info of connecting to server and handling of disconnects

Started by ӔO, May 01, 2014, 07:38:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ӔO

While connecting to a server, there is only a bar representation of how much progress has been made to connect.
And if your internet disconnects while transferring, the game will wait forever in the loading screen.

Could there be a numerical representation of how much of the save game is transferred? I prefer (transferred KB/total KB)

Could the game potentially detect when there is no more connection and cancel the transfer? Currently, you have to close it, because the program becomes unresponsive.
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

Ters

Sounds like a familiar problem from work. If the connection breaks under the right circumstances (I think it is when waiting to receive data), there is no way of knowing that it has broken, as opposed to the sending side just taking a long time to send the data or some congestion along the way (or as far as the underlying protocol is concerned, there simply isn't supposed to be transmitted any data). Simutrans is however down on the socket API and can choose to set timeouts and assume that the connection is dead if they fail. The big question is what that timeout should be to avoid dropping connections that is just temporarily a bit slow.

prissi

Simutrans relies on Windows Posix subsystem. Go, blame them (and the libary makers). Timeout in Windows during my test were (depending on version and libary version) something between 30s and >10 min. It never was that badly under Linux for me, although I did not do many tests there.

We ask the routine for a 10s timeout. If the routine has some data, we ask it for all the data it got. But sometimes the routine says it has data but then does not and hangs. That is all we can do.




Ters

At work, we've had systems hanging for days. As far as I have been able to figure out, TCP has no heartbeat by default. But there appears to be a SO_KEEPALIVE option one can turn on, but I have never tried using it. It seems that the default time-out is two hours on both Windows and Linux, but this in configurable for both. At this point, it begins sending keepalive packets relatively often (configurable, but appearently with different defaults). If a certain number of keepalive packets are sent without a response, the connection is considered dead. I assume this means recv will return with an error.

prissi

OK, I added some code with adds 10s timeouts to file transfers.

TurfIt

Quote from: ӔO on May 01, 2014, 07:38:14 AM
Could there be a numerical representation of how much of the save game is transferred? I prefer (transferred KB/total KB)
That's the information conveyed by the bar, although it was broken. Assuming it's working, are the numbers needed too?

Sarlock

If the bar is properly filling, I think that would work fine, at least then you'd know where you're at with the download (and how long you have to get a cup of coffee before it's done...).
Current projects: Pak128 Trees, blender graphics

AP

Another related issue - when gameplay is in progress and the server connection is lost, the player can carry on playing - there is no pup-up or other prominent indication that something is wrong, which I suggest needs addressing. The only clue is the absence of a little tiny icon in the corner. I've wasted a good few hours this way.

Sarlock

Interesting.  I always get the Simutrans main menu come up when I lose connection (the one that allows you to start a new game/load, etc).  I wonder what is different between us that doesn't give you that.
Current projects: Pak128 Trees, blender graphics

Sarlock

FYI, if you're interested in seeing how much progress you've made in downloading the server game, just check in your Simutrans user folder (on Windows) and watch the file "clientx-network.sve" grow in size by refreshing.  Current server game is around 45MB.
Current projects: Pak128 Trees, blender graphics

ӔO

Quote from: TurfIt on May 01, 2014, 11:00:13 PM
That's the information conveyed by the bar, although it was broken. Assuming it's working, are the numbers needed too?

For me, the download completes at about 70% of the bar, then it goes into the loading/creating map bar for about 1~2 seconds
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

prissi

The bar is updated in 4kB intervalls. If the game is small enough, then it will end a little bit before.