UDP [英] UDP

查看:90
本文介绍了UDP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须处理以下情况:

我需要在服务器和本地网络中的所有客户端之间建立特殊通信。

I need to establish a special communication between the server and all clients in a local network.

通信不能基于连接,所以我需要使用UDP(我猜)。

The comunnication cannot be based on conections, so I need to use UDP (I guess).

主要思想是在任何特定时刻用户都可以发送"广播"。来自服务器的所有客户的消息。

The main idea is that at any specific moment a user could send a "broadcast" message to all clients from the server.

例如,想象一下是时候吃晚餐了,你想建议你所有的人工人......

For example, imagine it´s time to have dinner and you want to advise all your co-workers...

我一直在考虑一个可能的解决方案,但我不确定如何实现......

I have been thinking about a possible solution, but I am not pretty sure how to implement that...

客户端:在所有客户端中运行的应用程序,它不断检查一个特定端口上的新消息。

Client:  Application running in all clients, that are constantly checking for new messages on one specific port.

服务器:在特定时刻向所有客户发送广播消息的应用程序。

Server:  Application that send broadcast messages to all clients on a specific moment.

如果您对如何理解,请告诉我我实现了这个。

Please let me know if you have an idea of how could I implement this.

谢谢,

Esteban

哥斯达黎加

推荐答案

您好Esteban,

Hi Esteban,

如果您需要此功能,那么您可以使用UDPClient类。如果我看你的要求你可以使用UDP协议和brodcast你的消息。在广播的情况下,你不需要任何确认或响应。 UDP是单向协议,它不会是b $ b做手握手。我们使用的情况是我们不希望在particalur地址中发送的任何数据包的确认。

if you required this function then you can use UDPClient class. if i look at you requirment you can use UDP protocol and brodcast your message. in case of broadcasting you don't need any ack or ersponse by the cleints. UDP is one way protocol it will not do handshak. We use in case of we do not want any ack of the packet which is sent in the particalur address.

我希望这会有所帮助!


这篇关于UDP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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