From: John Hodge (sonata) Date: Fri, 26 Dec 2014 23:29:23 +0000 (+0800) Subject: AcessNative - Set SO_REUSEADDR X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=fb6b8936f33aae9477e3cb3b191fee5247d2248a;p=tpg%2Facess2.git AcessNative - Set SO_REUSEADDR --- diff --git a/AcessNative/acesskernel_src/server.c b/AcessNative/acesskernel_src/server.c index 8de8ad3a..4dd964ca 100644 --- a/AcessNative/acesskernel_src/server.c +++ b/AcessNative/acesskernel_src/server.c @@ -228,6 +228,13 @@ int SyscallServer(void) server.sin_port = htons(SERVER_PORT); server.sin_addr.s_addr = htonl(INADDR_ANY); + #if USE_TCP + { + int val = 1; + setsockopt(gSocket, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val); + } + #endif + // Bind if( bind(gSocket, (struct sockaddr *)&server, sizeof(struct sockaddr_in)) == -1 ) {