Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search for the available port #27

Closed
bookwar opened this issue Dec 2, 2011 · 2 comments
Closed

search for the available port #27

bookwar opened this issue Dec 2, 2011 · 2 comments

Comments

@bookwar
Copy link

bookwar commented Dec 2, 2011

When port 30000 is already taken by some other application, one can not start new single player game (the one with empty Server field). And minetest gives the following output:

AuthManager: loading from /home/bookwar/.minetest/world/auth.txt
BanManager: loading from /home/bookwar/.minetest/world/ipban.txt
6: Bind failed: Address already in use

In thread 7ffa4fb13700:
/builddir/build/BUILD/celeron55-minetest-bc0e5c0/src/connection.cpp:577: virtual void* con::Connection::Thread(): Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD 7ffa4f312700:
#0  virtual void* ServerThread::Thread()
#1  void Server::Receive()
(Leftover data: #2  void Server::SendBlocks(float))
DEBUG STACK FOR THREAD 7ffa5ac20740:
#0  int main(int, char**)
(Leftover data: #1  void Server::start(short unsigned int))
Aborted

I think the more "user-friendly" way to handle this is to find the new port number for the minetestserver instance.

So, before running the server on port 30000 the client program could check if this port is free to use. If not check the port 30001, 30002.. and use the first available.

@kahrl
Copy link
Contributor

kahrl commented Dec 5, 2011

Good idea, but maybe try random or sequential ephemeral / dynamic ports (49152 to 65535) for this purpose instead of user ports (1024 to 49151)

Another option would be to not use UDP for a single player game, but simply internally copy the messages from server to client and vice versa. But that is harder to implement and has the disadvantage that wireshark can no longer be used to analyze single player minetest.

@PilzAdam
Copy link
Contributor

ab145c8

y5nw pushed a commit to y5nw/minetest that referenced this issue Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants