SDL_net
SDL_net copied to clipboard
SDLNet_CreateServer: set SO_REUSEADDR
SO_REUSEADDR
is needed to quickly reuse the same port after the application crash or forgets to close all connections properly.
int opt = 1;
setsockopt(server->handle, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
just before int rc = bind(server->handle, addrwithport->ai_addr, addrwithport->ai_addrlen);
will do the job.
Let me know if I shall create a PR for you.