-
-
[求助]udp多播抓不到包问题
-
发表于:
2017-5-29 12:38
3807
-
代码如下
package socket;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
public class SocketClient {
public static void main(String[] args)
{
int port=9111;
String host="239.255.255.239";
String data="Hello world";
while(true)
{
try
{
InetAddress ip = InetAddress.getByName(host);
DatagramPacket packet = new DatagramPacket(data.getBytes(),data.length(),ip,port);
MulticastSocket ms = new MulticastSocket(55665)
ms.joinGroup(ip);
ms.setTimeToLive(1);
ms.send(packet);
System.out.println("I have send it");
ms.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
向外多播一条信息,我在真机里面运行,用wireshark抓不到包,但在虚拟机里可以抓到包,请问为什么?
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)