尝试将数据包单播到可用网络的问题 [英] Problem Trying to unicast packets to available networks

查看:33
本文介绍了尝试将数据包单播到可用网络的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将数据包单播到可用网络.总共有3个网络.设法仅在一个网络中接收数据包.但我无法在不同网络中接收数据包.

Trying to unicast packets to available networks. There are totally 3 networks. Managed to get packets in only one network.But i am not able to receive the packets in different networks.

使用此代码..

        foreach (var i in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
        {
            foreach (var ua in i.GetIPProperties().UnicastAddresses)
            {
                System.Windows.Forms.MessageBox.Show(ua.Address.ToString());
                IPAddress Tip = IPAddress.Parse(ua.Address.ToString());
                IPEndPoint targetEndPoint = new IPEndPoint(Tip, iTargetPort);
                MyUdpClient sendUdpClient = new MyUdpClient();
                int numBytesSent = sendUdpClient.Send(CombineHeaderBody, CombineHeaderBody.Length, targetEndPoint);
            }
        }

问题是什么?谢谢.

推荐答案

我认为您是在尝试向自己发送数据包?

I think that you're trying to send packets to yourself?

您确定不会混淆单播地址和多播地址吗?

Are you sure you're not confusing unicast and multicast addresses?

好的,所以你不是在尝试多播...

Ok so you're not trying to multicast...

您的每个网络接口都有一个 IP 地址.你在这里所做的是向你的网卡发送一个数据包.这不是真正的网络问题,因为您的机器很可能知道自己的 IP 地址并将其重新路由到 127.0.0.1

Each of your network interface has an ip address. What you're doing here is sending a packet to your network card. It is not really a matter of network because your machine most probably knows its own ip addresses and reroute it to 127.0.0.1

这篇关于尝试将数据包单播到可用网络的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆