我正在使用一个UdpClient
从多播组中读取数据。
它是这样配置的:
m_udpClientReceiver = new UdpClient();
m_receivingEndPoint = new IPEndPoint(IPAddress.Any, m_port);
m_udpClientReceiver.ExclusiveAddressUse = false;
m_udpClientReceiver.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
m_udpClientReceiver.ExclusiveAddressUse = false;
m_udpClientReceiver.Client.Bind(m_receivingEndPoint);
m_udpClientReceiver.JoinMulticastGroup(m_multicastAddress, 255);
我读了它:
Byte[] data = m_udpClientReceiver.Receive(ref m_receivingEndPoint);
我有几个网卡(两个 LAN,一个 wifi),绑定在不同的子网上。我需要知道在哪个网卡(实际上是哪个 ip)上收到了请求。
我怎样才能做到这一点?
谢谢!