The problem here is that I see that the data is being written to the socket, but it is NOT ALWAYS sent.
Here is the sniplet of code
ByteBuffer writeBuffer = ByteBuffer.allocate(8192); writeBuffer.clear(); writeBuffer.put("heartbeat".getBytes()); writeBuffer.flip(); LOG.debug("is connected: " + socketChannel.isConnected()); int bytesWritten = 0; if (key.isWritable()) { while (writeBuffer.hasRemaining()) { bytesWritten += socketChannel.write(writeBuffer); } }
I use TCPMon to find out if the actual data is written to the socket - WHICH.
But using WireShark (another network monitoring tool), I do not see the packet passing through the network adapter.
Any help would be appreciated
source share