From f63d616bc048fe256181ff5e7e4aaca11afe3237 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Mon, 27 Jun 2011 17:04:32 -0700 Subject: [PATCH] Use poll by default for socket.connect(), instead of select(). Connect timeouts are implemented by waiting on the new socket descriptor. When select() is used for this, it imposes an arbitrary limit on the number of connections that can be made, usually 1024-3. Using poll() removes this limit on the number of simultaneous TCP connections can be made using luasocket. The previous default implementation using select() is available by defining SOCKET_SELECT. Note that using socket.select() always uses select(), so it isn't possible to wait on an arbitrary number of connections at once. --- src/usocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usocket.c b/src/usocket.c index 97f8b4f..e43cfa4 100644 --- a/src/usocket.c +++ b/src/usocket.c @@ -16,7 +16,7 @@ /*-------------------------------------------------------------------------*\ * Wait for readable/writable/connected socket with timeout \*-------------------------------------------------------------------------*/ -#ifdef SOCKET_POLL +#ifndef SOCKET_SELECT #include #define WAITFD_R POLLIN