I am working on a application on MEGACO protocol on Controller side. I am sending MEGACO messages to the Media Gateway via UDP prptocol. And the Media gateway is answering the requests. When I run wireshark with specified port and IP filter wireshark shows all the captured MEGACO packets. But in my application (written in JAVA) some of the packets are not reaching. More specifically saying to my application only Transaction Reply and Transaction Reply Acknowledgement (Reference: RFC 3015) messages are not reaching.
I have tried a lot of permutations and combinations. Even I have allocated new Datagram Packet and buffer space for each receiving messages as test. But no result. My code for the udp receiver is following.
while (running) {
//do work here
try {
byte[] dpBuffer = new byte[MAX_BUFFER_SIZE];
DatagramPacket dp = new DatagramPacket(dpBuffer, MAX_BUFFER_SIZE);
this.socket.receive(dp);
byte[] temp = new byte[dp.getLength()];
System.arraycopy(dp.getData(), 0, temp, 0, dp.getLength());
System.out.println("Read data");
for(int i=0;i<temp.length;i++)
{
System.out.print((char)(temp[i]));
}
ByteArrayUtil msg = new ByteArrayUtil(temp, dp.getLength());
msgParser.parseMsg(msg);
} catch (Exception e) {
logger.error("Megaco Reader Failed to read Packet due to :" ,e);
}
}
Any help??