将消息发送到网络。 [英] Sending message to the network.

查看:78
本文介绍了将消息发送到网络。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 Socket sock = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,
ProtocolType.Udp);
IPAddress serverAddr = IPAddress.Parse(" 192.168.2.255");
IPEndPoint endPoint = new IPEndPoint(serverAddr,11000);
string text =" Hello" ;;
byte [] send_buffer = Encoding.ASCII.GetBytes(text);
sock.SendTo(send_buffer,endPoint);


我在这里要做的是通知网络内的所有计算机都会发生什么。例如,其中一台计算机发送一条消息,例如"你好吗?"然后网络中的所有其他计算机将能够收到
它。上面的代码只将数据发送到特定的计算机,但我希望所有的计算机都能够接收数据。



问候郎

解决方案

您好


你的问题解决了吗?如果是,请发布"标记为答案"如果他们遇到类似问题,它将帮助其他
成员快速找到解决方案。


最诚挚的问候,


杰克


Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
IPAddress serverAddr = IPAddress.Parse("192.168.2.255");
IPEndPoint endPoint = new IPEndPoint(serverAddr, 11000);
string text = "Hello";
byte[] send_buffer = Encoding.ASCII.GetBytes(text );
sock.SendTo(send_buffer , endPoint);

What I am trying to do here is to notify all the computers inside the network that something will happen. For example, one of the computers sends a message like "How are you" and then all the other computers inside the network will be able to receive it. The code above only sends the data to a specific computer but i want all the computers to be able to receive the data aswell.

Regards

解决方案

Hi

Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find a solution quickly if they face a similar issue.

Best Regards,

Jack


这篇关于将消息发送到网络。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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