Problem accepting connections in nio-based-server running on linux Gentoo
Hey Guys,
I've encountered a strange problem in my nio-server-thingy running on Linux Gentoo:
I am using the standard handling connections loop for nio with going over the keys and checking which OP it is and i saw the following
there are times i do not getisAcceptable for clients i see their SYN packets in tethereal of this machine.
This is a very busy machine receiving lots of SYN packets, could it be that i did not configure something correctly on this machine so it does not direct all SYN packets to my application?
This is the code i am using - as i mentioned before, i see the SYN but i do not get the isAcceptable even. This is the basic loop handling connections in nio, am i missing something?
publicvoid handleConnections()throws IOException
{
log.finest(null);
int numberOfReadyChannels = selector.select(getSelectorTimeoutMillis());
if (numberOfReadyChannels == 0)
{
log.finest("No ready channels");
return;
}
for (Iterator<SelectionKey> iter = selector.selectedKeys().iterator(); iter.hasNext();)
{
SelectionKey key = iter.next();
iter.remove();
if (key.isValid() && key.isAcceptable())
{
log.finest("isAcceptable");
handleAccept(key);
}
if (key.isValid() && key.isConnectable())
{
log.finest("isConnectable");
handleConnect(key);
}
if (key.isValid() && key.isReadable())
{
log.finest("isReadable");
handleRead(key);
}
if (key.isValid() && key.isWritable())
{
handleWrite(key);
}
}
}

