2

I want to run the minecraft server.jar with an attached tcp socket, so I use:

socat EXEC:"java -jar server.jar nogui" TCP-LISTEN:25567,fork 

I can connect (and disconnect) to the server without any problems via telnet. But when I stop the server (via /stop) the server terminates (checked with ps auf, the process is definitely gone) but socat just doesn't terminate.

How can I start socat so it terminates after the EXEC-child is terminated? (I already tried using SYSTEM: instead of EXEC: but that was trying)

1 Answer 1

1

The fork option tells socat to continue listening in the main process and handle connections in the child processes. This enables it to serve multiple minecraft server instances at once, one for each client that connects. It also means that the socat server will continue listening for new connections after all of them have disconnected, so that it can continue serving more minecraft server instances to clients that connect.

If you simply remove this fork option, it should only accept one connection and serve one minecraft server and then exit when the server stops.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.