TcpClient 与 MSMQ

发布于 2024-09-26 18:18:30 字数 538 浏览 1 评论 0原文

我正在开发一个应用程序,该应用程序需要与运行在不同位置的不同计算机上的自身进行通信。我本来打算使用 TcpListener 和 TcpClient 在应用程序之间发送信息,但后来我遇到了 MSMQ。

计算机通过软件 VPN 连接,该软件通过我的标准互联网连接进行通信。

现在我不知道该使用哪种技术,TcpClient 还是 MSMQ。

我想发送不同类型的信息请求并传输文件。我的数据库中有大量数据,这些数据太大而无法通过互联网发送到应用程序。因此,我想从一个应用程序向另一个应用程序发送请求,该应用程序将运行查询,将结果保存到 xml,压缩它,然后将文件发回。然后,接收应用程序将解压缩并加载 xml 数据集,有望节省大量时间。 (未压缩约为 10Mb+,压缩约为 0.3Mb)

会有不同类型的信息请求。因此,我希望我的应用程序能够区分请求,但我不确定如何最好地接收信息,然后确定该信息实际上是什么(即它是什么类型的请求) )

在某些情况下,一种技术是否优于另一种技术?

任何有关如何最好地实现我所描述的场景的指示也将受到极大的赞赏!

非常非常感谢!

I'm developing an application that will need to communicate with itself running on different machines located in different locations. I was going to use TcpListener and TcpClient to send information between applications but then I came across MSMQ.

The computers are connected via software VPN, which communicates across my standard internet connection

Now I don't know which technology to use, TcpClient or MSMQ.

I will want to send a different types of information requests and also transmit files. I have a large amount of data in a database which is too large to send across the internet to the application. So I want to send a request from one app to the other which will run a query, save the results to xml, compress it, and then send the file back. The receiving application will then decompress and load xml data set, hopefully saving a great amount of time. (Uncompressed this is about 10Mb+, compressed this is about 0.3Mb)

There will be different types of requests for information. So, I want my application to be able to differentiate between the requests, but I'm not sure how best to receive information and then determine what that information actually is, (i.e. what type of request it is)

Are the certain situations that one technology is better than the other?

Any pointers about how best to implement the scenario I've described will also be greatly, greatly appreciated!

Many, many thanks!

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

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

发布评论

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

评论(1

仅一夜美梦 2024-10-03 18:18:31

您可能需要考虑使用 Windows Communication Foundation 而不是推出自己的解决方案。

它允许您使用 TCP 或 MSMQ(甚至 Http/https)进行通信,并且可以根据需要重新配置。它还使处理消息类型的差异变得容易 - 您可以使用标准 .NET 开发技术,而不必担心流、安全性和其他问题。

You might want to consider using Windows Communication Foundation instead of rolling your own solution.

It allows you to use TCP or MSMQ (or even Http/https) for your communication, and can be reconfigured as needed. It also makes handling the differentiation of message types easy - you can use standard .NET development techniques and not worry about the streaming, security, and other issues.

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