Hi there,
the Socket Channel doesn’t wait for incoming messages. The select() Method always return.
–> I got 100% CPU utilization because the while is always running.
Any suggestions ?
Here is the code snippet:
InetSocketAddress socket = new InetSocketAddress(“C9769CE0”,8100);
socketChannel = SocketChannel.open();
socketChannel.configureBlocking(false);
socketChannel.connect(socket);
socketChannel.finishConnect();
Selector selector = SelectorProvider.provider().openSelector();
SelectionKey key = socketChannel.register(selector,SelectionKey.OP_READ);
CharBuffer charBuffer = CharBuffer.allocate(1024);
b.clear();
int keysAdded;
while (true)
{
key.selector().select();
................
–> the select method dont wait here for incoming messages ?