Running multiple Cafu instances requires manually assigning a server port

Issue #54 wontfix
Carsten Fuchs
created an issue

As described at http://www.cafu.de/forum/viewtopic.php?p=4060#p4060 and the posts following, it is currently not easily possible to run multiple instances of Cafu at the same time (useful e.g. for network testing).

The root cause of the problem is that the Cafu server binds to the server port right on program start, failing if that port is already in use by other programs (e.g. the previous Cafu instance).

The problem can be worked-around by assigning different server (and client) ports to the subsequent Cafu instances using the -clPort and -svPort command-line options. It would however be preferable to change the default behavior to improve the user experience.

Potential solutions include: - Change the server to acquire a socket and bind it to a port only when the server is actually started (instead of doing so in advance on program start). Note that this requires proper reporting of errors - if the deferred socket init fails, we must present the user a GuiSys dialog. - (Alternatively, have the second and following Cafu instances behave differently from the first, e.g. use default port number + N...) - Change the ''client'' default port to 0 in order to have one assigned by the OS (as mentioned in my forum post).

Comments (3)

  1. Carsten Fuchs reporter

    Also note that the "Host Game Server" dialog has an input widget for specifying the local server port, but this is effectively unused as the socket has already been allocated on program init.

  2. Log in to comment