konstructs / client

A voxel based game client.
http://www.konstructs.org
MIT License
48 stars 8 forks source link

Client should check if the server really hosts konstructs #91

Closed Henningstone closed 7 years ago

Henningstone commented 9 years ago

Some kind of verification message between client and server would be nice instead of the simple check if the host can be resolved.

For instance, try connecting to "google.com". Of cause it can be resolved, so no error. What happens after entering username and password is quite funny... Not. Game hangs, mouse is locked and I can't get it back by pressing esc because yes, the game hangs ._. Luckily I've bound the system monitor to Ctrl+Shift+Esc, and could navigate it without a mouse to kill konstructs :) Anyways, NOT NICE! :angry:

nsg commented 9 years ago

Yes, I have been affected by that a few times as well :) (alt-tab works in my windows manager)

It's a little tricky to check it directly, we do not connect to the server until after the password is entered. So I suggest that we add some type of check in the connecting logic with an appropriate error message to the user.

petterarvidsson commented 8 years ago

The basic problem is that google doesn't respond to the SYN package at all, so we have to wait for the timeout before we can report an error. I have improved the connection handling quite a bit in #180 and I though this might have been fixed as well, but it seems to be really hard to solve this one. Most programs behave in a similar manner here, since the behaviour of google.com is not standard (even though everyone is doing it). You can try entering http://google.com:1234/ into your web browser and see how it will attempt to "connect" for a very long time (but of course it "lock up").

The best fix here would either be to do a non-blocking connect or to connect from a different thread. http://stackoverflow.com/questions/2597608/c-socket-connection-timeout. Both of those are fairly tricky so I will leave this issue for now. In general, if the server is responding to SYN it will now work correctly.

If anyone have a good idea on how to solve this more easily it would be very welcome.