I
I
IsaevDev2015-07-01 18:37:58
Java
IsaevDev, 2015-07-01 18:37:58

Is it possible to read from multiple sockets in one thread?

Let's say there is an array of sockets and buffers where connections come after .accept() from another thread. In the loop I check if there is something in the buffer. If there is, I read it and send it to another thread for processing.
All this happens in java
So it is possible to make not to produce flows for each client?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Moseychuk, 2015-07-01
@IsaevDev

See Selector from NIO. An analogue of the sish, allows the use of non-blocking sockets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question