沟通 [英] Communication

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

问题描述

Hallo亲爱的大家,

如何在客户端和服务器之间建立连接,而不是使用TCP/IP(Socket)?
我听说有可能,可以从给定的URL发布和获取消息.例如,考虑有两台机器MachineA和MachineB. MachineA必须始终检查给定URL上的传入消息,而MachineB则在该给定URL上发送或放入消息.反之亦然,MachineA可以充当MachineB,MachineB可以充当MachineA.

我认为可以将HttpListner类用于此类问题.
有可能吗?

谢谢

Hallo Dear Everyone,

How can I create a connection between client and server, rather than using TCP/IP(Socket)?
I have heard that is possible, posting and getting messages from a given URL. For example, consider there two machines, MachineA and MachineB. MachineA has to always check for an incoming message on at a given URL, and MachineB sends or puts a message on that given URL. This has to work in vice versa, MachineA may act as MachineB and MachineB may act as MachineA.

I think it is possible to use the HttpListner class for such problem.
Is that possible?

Thank You

推荐答案

虽然Nishant Sivakumar提供了一个很好的答案,但您也可以看看:
MessageQueue [ MessageQueue.BeginReceive [
While Nishant Sivakumar has provided an excellent answer, you could also take a look at:
MessageQueue[^] - the .Net interface to MSMQ.

Take a look at MessageQueue.BeginReceive[^] - depending on what you are doing, this might be both more flexible, and easier to implement.

Using MSMQ with WCF is also an option...

Regards
Espen Harlinn


我知道一个网页上有一个类似的解决方案,但我不知道它是否在使用TCP/IP.

这是链接:
^ ]

希望对您有帮助
I know a webpage where there is a solution like that wether i don''t know if it is using TCP/IP or not.

Here is the link: how-to-create-a-callback-form-using-the-c-sip-voip-softphone-source-voip[^]

Hope it is helpful


您可以通过WCF进行此操作. MachineA订阅ServerC上的回调服务. MachineB连接到ServerC并定期发送消息,而MachineA通过回调自动接收它们.

[更新]
--------------

为了回答更新的问题,虽然可以使用HttpListener,但是现在您不会自动获取回调(在WCF中存在). WCF也支持HTTP协议进行通信.因此,没有真正的需要避免使用WCF.但是,如果您不想走WCF路线,则可以编写自己的服务器应用程序,不同之处在于客户端计算机要么需要轮询服务器,要么需要在每台服务器上实现某种类型的瘦监听服务器.客户端来模拟/促进基于推送的回调机制.
You can do this via WCF. MachineA subscribes to a callback service on ServerC. MachineB connects to ServerC and periodically sends messages, and MachineA automatically receives them via the callback.

[Update]
--------------

In response to your updated question, while you can use HttpListener, now you would not automatically get callbacks (which is there in WCF). And WCF supports HTTP protocols too for communication. So there''s no real need to avoid WCF. But if you don''t want to go the WCF route, you can write your own server app, except that the client machines would either need to poll the server or you''d need to implement some kind of thin listening server on each client to simulate/facilitate a push based callback mechanism.


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

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