Hi,
To understand this issue , wrote simple socket program with DatagramPacket.receive method.
Program works fine in centOS7 but it is not working in centOS8.
Let me know if the issue specfic to centOS8?
Program snip:
int transId = sequence.incrementAndGet();
try{
ByteBuffer getBuffer = ByteBuffer.allocate(DATAGRAM_LENGTH);
byte transByte1 = (byte) (transId & 0xFF);
byte transByte2 = (byte) ((transId >> 8) & 0xFF);
buildHeader(getBuffer, transByte1, transByte2);
String getBuf = "stats\r\n";
getBuffer.put(getBuf.getBytes());
DatagramPacket getPacket = new DatagramPacket(getBuffer.array(),getBuffer.position());
getPacket.setSocketAddress(sa);
DatagramSocket socket = channel.get().socket();
socket.send(getPacket);
DatagramPacket getResult = new DatagramPacket(new byte[DATAGRAM_LENGTH], DATAGRAM_LENGTH);
socket.setSoTimeout(MEMCACHE_MONITOR_TIMEOUT);
socket.receive(getResult);
byte[] data = getResult.getData();
if(data != null){
return true;
}
}
catch (SocketTimeoutException so)
{
try {
channel.get().close();
DatagramChannel newChannel = DatagramChannel.open();
newChannel.configureBlocking(true);
channel.set(newChannel);
} catch (IOException e) {
}
System.out.println("Get Stats from socket timed out");
return false;
}
Thanks