Coder Social home page Coder Social logo

Comments (8)

daid avatar daid commented on August 28, 2024

There is actually most code to handle this already. Disconnections are detected, but not always handled correctly yet.
Example, this code is disabled right now:
https://github.com/daid/EmptyEpsilon/blob/master/src/screens/mainScreen.cpp#L40

from emptyepsilon.

kwadroke avatar kwadroke commented on August 28, 2024

Looks like the send disconnect for clients is working. The client with autoconnect goes back to the waiting for server screen.
Not sure if I should open a new issue for the clients not wanting to auto-reconnect after the server has went away and came back. You have to exit EE completely on the server and restart it to have the autoconnect clients connect again. Server and client was tested on the same machine.

from emptyepsilon.

daid avatar daid commented on August 28, 2024

Might take a while for clients to re-connect after an auto connect. If it takes longer then 30 seconds, then there is a bug there.

from emptyepsilon.

kwadroke avatar kwadroke commented on August 28, 2024

Looks like a bug. The autoconnect client looks like it's trying to connect, as it briefly changes from "Searching for server..." to (what I'm guessing is) connecting to server, and then back to Searching.
I ran it for several of minutes without the client re-establishing connection. When I shutdown & exit out the program on the server while the autoconnect client is still running, and then start EE again then create a server, the client autoreconnects fine.

from emptyepsilon.

kwadroke avatar kwadroke commented on August 28, 2024

Think I might have figured out the issue I am having. Looks like the connection to the server from the client is still in TIME_WAIT status. Which is causing the Server not to be able to use the same TCP Port when run on the same machine as the client. I only noticed this when I tried to run it as a headless server since the Game window wasn't covering my terminal.

Error from the command line:

Failed to bind listener socket to port 35666
[ERROR] Failed to listen on TCP port: 35666

output of netstat -tapn when exiting the server

tcp        0      0 10.0.2.15:35666         10.0.2.15:59745         TIME_WAIT   - 

Once the connection finally clears out, it will allow me to restart the server.

Most people will probably not notice this problem unless they run the server and the client on the same machine. This is how I do my testing after you do a new commit.

from emptyepsilon.

kwadroke avatar kwadroke commented on August 28, 2024

Just tested from Linux (VM guest) to Windows 7 (VM Host): it auto-reconnects fine.

from emptyepsilon.

daid avatar daid commented on August 28, 2024

The TIME_WAIT for server sockets is a annoying thing. It does solve itself after 2 minutes, and you can disable it on linux at a system level (but you shouldn't)

Normally you can hack around this by setting the SO_REUSEADDR flag on the listen socket, but SFML does not support this.

Problem is that EE does not handle this gracefully yet. As it should tell the user that it cannot start the server, instead of silently doing "nothing" and act like there is a server.

from emptyepsilon.

daid avatar daid commented on August 28, 2024

Should be fixed in latest, clients properly disconnect, and you no longer need to close the server to change scenario.

from emptyepsilon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.