Questions tagged [posix-select]

22 questions
69
votes
2 answers

select vs poll vs epoll

I am designing a new server which needs to support thousands of UDP connections (somewhere around 100,000 sessions). Any input or suggestions on which one to use?
ravi
  • 745
  • 1
  • 7
  • 4
18
votes
3 answers

socket select ()versus non-block recv

I've seen a few write-ups comparing select() with poll() or epoll(), and I've seen many guides discussing the actual usage of select() with multiple sockets. However, what I can't seem to find is a comparison to a non-blocking recv() call without…
Gren Meera
  • 181
  • 1
  • 1
  • 4
8
votes
1 answer

What is the issue of select() using so much CPU power?

I am writing a network communication program using non-blocking sockets (C/C++) and select. The program is pretty big, so I cannot upload source code. In a very aggressive testing session, I use testing code to open and close both TCP and UDP…
user180574
  • 5,681
  • 13
  • 53
  • 94
7
votes
2 answers

Why use select(), when we have poll() and epoll()

I looked at the differences between poll, epoll and select. What I don't understand is when should I use select. I don't see any advantage, given that poll and epoll have everything that select has, and more.
Luke SpringWalker
  • 1,600
  • 3
  • 19
  • 33
6
votes
3 answers

Cannot use Python select.poll in Mac OS?

$ 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…
Zhang Jiuzhou
  • 759
  • 8
  • 22
4
votes
1 answer

Using select() with pipes

The idea is to create a binary process tree that sends information down the tree, then sends values back up the tree, aggregating information as it ascends. The problem I am having is with using select() to determine when pipes are ready to be read…
ReezaCoriza
  • 133
  • 4
  • 16
4
votes
2 answers

Is C select() function deprecated?

I am reading a book about network progamming in C. It is from 2004. In the example code, author is using select C function to accept multiple connections from the client. Is that function deprecated today? I see that there are different ways to…
Miroslav Trninic
  • 3,327
  • 4
  • 28
  • 51
3
votes
3 answers

How to use POSIX select()

Shoud I make file descriptors non-blocking before using them in select()?
Mihran Hovsepyan
  • 10,810
  • 14
  • 61
  • 111
2
votes
2 answers

How to write data to stdin to be consumed by a separate thread waiting on input from stdin?

I am trying to read some data from stdin in a separate thread from main thread. Main thread should be able to communicate to this waiting thread by writing to stdin, but when I run the test code (included below) nothing happens except that the…
Knight Forked
  • 1,529
  • 12
  • 14
2
votes
2 answers

Socket programming in C, using the select() function

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); …
anon
  • 251
  • 1
  • 6
  • 10
2
votes
1 answer

Pthread producer/consumer with select() calls for file I/O

I am trying to improve the capture performance of a real-time computer vision program that I am developing to run on an embedded Linux computer using OpenCV. I would like to use multiple threads and a shared memory buffer to separate the tasks of…
1
vote
1 answer

Making read and write sets with FD_SET for sending and receiving data in C

I have a client and server, and the client runs a select loop to multiplex between a TCP and a UDP connection. I'm trying to add my TCP connection file descriptor to both the read and the write set and then initiate one message exchange using write…
Zahaib Akhtar
  • 1,068
  • 2
  • 11
  • 26
1
vote
1 answer

Segmentation fault when using select() to monitor pipes

I am working on a project the premise of which is to create a process tree where a parent process sends half of a string(of digits) to each of its two child processes through pipes, then, when the number is <=2 tally the number of times the digit…
ReezaCoriza
  • 133
  • 4
  • 16
0
votes
2 answers

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

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…
julumme
  • 2,326
  • 2
  • 25
  • 38
0
votes
0 answers

Expected 'select' behavior while using a socket without connection attempts

There are many questions looking similarly but I did not find anything close to the issue I am trying to figure out. I am using the same code on Linux (RedHat, GCC) and Windows (MSVC). POSIX API is used in the both cases and the differences are…
Mtm 3.14
  • 29
  • 5
1
2