将事件发送到所有工作站的最佳方式是什么

发布于 2024-07-10 17:24:45 字数 598 浏览 6 评论 0原文

我希望有人能在我陷入困境时指导我......我需要编写一个紧急广播系统,通知工作站紧急情况并在用户屏幕底部弹出一条小消息。 这看起来很简单,但多个子网中有大约 4000 个工作站。 该系统需要几乎实时、轻量级并且易于部署为 Windows 服务。

当我发现路由器不转发 UDP 广播数据包 xxx255 时,问题就开始了。 后来我在 VB6 中做了一个简单的测试钩子来捕获网络发送消息,但即使这些消息也没有通过路由器。 我还编写了一个简单的数据包嗅探器来过滤数据包,却发现网络数据包从未到达预定目的地。

然后我查看并探索了使用 MSMQ over HTTP,但这需要在目标工作站上安装 IIS。 由于有如此多的工作站,这将是一个主要的安全问题。

现在我已经完成了一个带有异步回调的 Web 服务,该服务向订阅者发送事件。 它在小规模下工作得很好,但一旦订阅者超过 15 个,性能就会显着下降。 轮询服务器并不是真正的选择,因为它会在服务器上生成负载(而且我也尝试过)

我需要您的帮助来指导我使用什么技术。 有人用彗星方式处理这么多客户吗?还是我应该看看 WCF?

我正在使用 Visual C# 2005。请帮助我摆脱这个困境。

谢谢

I hope someone can guide me as I'm stuck... I need to write an emergency broadcast system that notifies workstations of an emergency and pops up a little message at the bottom of the user's screen. This seems simple enough but there are about 4000 workstations over multiple subnets. The system needs to be almost realtime, lightweight and easy to deploy as a windows service.

The problem started when I discovered that the routers do not forward UDP broadcast packets x.x.x.255. Later I made a simple test hook in VB6 to catch net send messages but even those didn't pass the routers. I also wrote a simple packet sniffer to filter packets only to find that the network packets never reached the intended destination.

Then I took a look and explored using MSMQ over HTTP, but this required IIS to be installed on the target workstation. Since there are so many workstations it would be a major security concern.

Right now I've finished a web service with asynchronous callback that sends an event to subscribers. It works perfectly on a small scale but once there are more than 15 subscribers performance degrades considerably. Polling a server isn't really an option because of the load it will generate on the server (plus I've tried it too)

I need your help to guide me as to what technology to use. has anyone used the comet way with so many clients or should I look at WCF?

I'm using Visual C# 2005. Please help me out of this predicament.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

自演自醉 2024-07-17 17:24:46

您是否可以在每个子网中拥有一个从属服务器,负责将消息分发给子网中的所有客户端?

然后,您可以将从属服务器连接到启动消息的中央服务器。

Could you have a slave server in each subnet that was responsible for distributing the messages to all the clients in the subnet?

Then you could have just the slaves attached to the central server where the messages are initiated.

浸婚纱 2024-07-17 17:24:46

我认为你们中的一些人对此想得太多了。 每个版本的 Windows 中都内置了一项服务,可以提供这种确切的功能! 它称为 Messenger 服务。 您所要做的就是确保该服务已启用并在所有客户端上运行。

(虽然您没有在问题中指定,但我根据您选择的技术假设该网络的客户端群体都是 Windows)。

您可以使用此工具从命令行发送消息,如下所示:

NET SEND computername "This is a test message"

NET SEND 命令还具有按 Windows 域发送的选项,或按名称发送到特定用户(无论他们在何处登录),或发送到连接的每个系统的选项。到特定的 Windows 服务器。 这些选项应该可以让您轻松避免子网问题,特别是当您在网络上使用基于域的安全性时。 (如果您通过服务器而不是直接向客户端发送消息,则可能需要在某些服务器上启用“Alerter”服务)。

其编程版本是一个名为 NetMessageBufferSend() 的 API,它是非常简单。 快速扫描 P/Invoke.net 可以找到此 API 的页面 它不仅提供调用 API 所需的定义,还提供 C# 示例程序!

您根本不需要编写任何客户端代码。 也许最涉及的事情是找出对此 API 的最佳调用集,以便在您的配置中完全覆盖网络。

ETA:我刚刚注意到 Messenger 服务和这个 API 在 Windows Vista 中完全消失了。 微软完全删除这样的功能非常奇怪。 看来该供应商有 Vista 的兼容替代品

I think some of you are vastly overthinking this. There is already a service built into every version of Windows that provides this exact functionality! It is called the Messenger service. All you have to do is ensure that this service is enabled and running on all clients.

(Although you didn't specify in the question, I'm assuming from your choices of technology that the client population of this network is all Windows).

You can send messages using this facility from the command line using something like this:

NET SEND computername "This is a test message"

The NET SEND command also has options to send by Windows domain, or to specific users by name regardless of where they are logged in, or to every system that is connected to a particular Windows server. Those options should let you easily avoid the subnet issue, particularly if you use domain-based security on your network. (You may need the "Alerter" service enabled on certain servers if you are sending messages through the server and not directly to the clients).

The programmatic version of this is an API called NetMessageBufferSend() which is pretty straightforward. A quick scan of P/Invoke.net finds a page for this API that supplies not only the definitions you need to call out to the API, but also a C# sample program!

You shouldn't need to write any client-side code at all. Probably the most involved thing will be figuring out the best set of calls to this API that will get complete coverage of the network in your configuration.

ETA: I just noticed that the Messenger service and this API are completely gone in Windows Vista. Very odd of Microsoft to completely remove functionality like this. It appears that this vendor has a compatible replacement for Vista.

今天小雨转甜 2024-07-17 17:24:45

考虑使用 WCF 回调机制和事件。 Juval Lowy 的很好的介绍

另一种模式是实施阻止 Web 服务调用。 例如,这就是 GMail 聊天的工作原理。 但是,您必须在这里处理会话和超时。 当客户端位于 NAT 和防火墙后面并且无法直接访问时,它可以工作。 但对于内网内的简单警报来说可能过于复杂。

Consider using WCF callbacks mechanism and events. There is good introduction by Juval Lowy.

Another pattern is to implement blocking web-service calls. This is how GMail chat works, for example. However, you will have to deal with sessions and timeouts here. It works when clients are behind NATs and Firewalls and not reachable directly. But it may be too complicated for simple alert within intranet.

一个人的旅程 2024-07-17 17:24:45

这正是多播的设计目的。

正常的网络广播(根据定义)保留在本地子网上,不会通过路由器转发。

另一方面,多播传输可以具有各种范围,从子网本地、到站点本地,甚至到全局。 您所需要的只是将子网连接在一起的各个路由器能够感知多播。

This is exactly what Multicast was designed for.

A normal network broadcast (by definition) stays on the local subnet, and will not be forwarded through routers.

Multicast transmissions on the other hand can have various scopes, ranging from subnet local, through site local, even to global. All you need is for the various routers connecting your subnets together to be multicast aware.

我认为这个问题最好用套接字解决。

打开与服务器的连接并保持打开状态。

This problem i think is best solved with socket.

Open a connection to the server, and keep it open.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文