posix-select

Socket programming in C, using the select() function

梦想的初衷 提交于 2021-01-28 01:10:54
问题 Based from the answers I got from this thread, I've created this: //Server sock_init(); //from SFL, see http://legacy.imatix.com/html/sfl/ timeout = 50000; serv_sock_input[0] = TCP(1234); serv_sock_input[1] = UDP(9876); input_protocols[0] = "tcp"; input_protocols[1] = "udp"; while (1) { FD_ZERO(&sock_set); for (x = 0; x<number_of_inputs; x++) { FD_SET(serv_sock_input[x], &sock_set); } select_timeout.tv_sec = timeout; select_timeout.tv_usec = 0; if (select(0, &sock_set, NULL, NULL, &select

Cannot use Python select.poll in Mac OS?

 ̄綄美尐妖づ 提交于 2020-01-01 09:42:10
问题 $ python Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import select >>> select.poll Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'poll' 回答1: Instead of using poll, use select.kqueue() on OSX. It's similar to 'epoll' on Linux in that you can more efficiently register for types of

Cannot use Python select.poll in Mac OS?

我的梦境 提交于 2020-01-01 09:41:23
问题 $ python Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import select >>> select.poll Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'poll' 回答1: Instead of using poll, use select.kqueue() on OSX. It's similar to 'epoll' on Linux in that you can more efficiently register for types of

select vs poll vs epoll [closed]

半世苍凉 提交于 2019-12-29 02:21:07
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am designing a new server which needs to support thousands of UDP connections (somewhere around 100,000 sessions). Any input or

*nix & C++ writing a non-blocking socket server

℡╲_俬逩灬. 提交于 2019-12-13 21:15:14
问题 I'm experiencing some issues with rewriting my blocking socket server to a non-blocking version. Actually, I can't seem to even get socket connected anymore, I've been googling for the most of today, and trying different solutions I find here and there, but none of them seem to work properly... Currently my server loop just keeps timeouting the select() call, with no new sockets accepted. Client socket seems to connect on some level, since if I start it, it will block trying to write, and if

Cannot use Python select.poll in Mac OS?

大兔子大兔子 提交于 2019-12-04 06:02:17
$ python Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import select >>> select.poll Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'poll' Instead of using poll, use select.kqueue() on OSX. It's similar to 'epoll' on Linux in that you can more efficiently register for types of file-descriptor / file system events which can be used in asynchronous code. Much more efficient than polling