1
我工作的控制器上侧MEGACO协议的应用程序。我通过UDP prptocol将MEGACO消息发送到媒体网关。媒体网关正在回应请求。当我运行wireshark与指定的端口和IP过滤wireshark显示所有捕获的MEGACO数据包。但在我的应用程序中(用JAVA写的)一些数据包没有到达。更具体地说,我的应用程序只有事务回复和事务响应确认(参考:RFC 3015)消息没有达到。Wireshark的捕获数据包,但JAVA应用不捕获
我已经尝试了很多排列组合。即使我已经为每个接收消息分配了新的数据报包和缓冲空间作为测试。但没有结果。我的udp接收器的代码如下。
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);
}
}
任何帮助?
我会重新检查那些Wireshark的捕获这些数据包的源端口和目的端口。 –
感谢您的评论。在您的评论之后,我刚刚检查了数据包中的端口字段。发现那些JAVA程序没有收到的包的目的端口是60800,但Wireshark和JAVA程序收到的包的端口都是2944.但是我不明白这一点! !我在wireshark中设置过滤器为“udp.port == 2944 && ip.src == IP address”但这些数据包中的数据包字段如何变成60800! –
“udp.port == 2944”将在目标端口和源端口中查找端口号。请记住,UDP数据包包含2个端口号,一个适用于每个系统。再看看,你会发现其中一个2944。 –