如何在网络中通信两台机器? [英] How to communicate two machines in network?
问题描述
嗨!
例如:
我们有两台机器A和B.
A-machine在防火墙后面,B-machine对A-machine一无所知。
我需要从B-machine发送数据到A-machine。
我认为它应该是这样的:
服务从A-开始机器并观察pipline或类似渠道中的某些数据,以及何时获取某些数据,请回复B-machine这些数据。
是否可以做WCF?我的意思是创建两个WCF服务,但B服务对A服务一无所知。
谢谢
你的描述很模糊,但让我试试:)
你在机器B上部署一个合同的服务,如
[ServiceContract ]
interface IMyService {
[OperationContract]
bool HasDataForB( );
[OperationContract]
Data GetData();
}
在机器A上,您以一定的间隔调用HasDataForB,当它返回true时,您只需调用GetData()。< /块引用>
您好!再一次。感谢回复。我在这里找到了解决方案
广播事件双工WCF服务 [ ^ ]
Hi!
For example:
We have two machines A and B.
A-machine behind firewall, B-machine doesn't know nothing about A-machine.
I need to send data from B-machine to A-machine.
I think it should be something like:
Service starts on A-machine and watch for some data in "pipline or something like channel", and when to get some data, respond to B-machine those data.
Is it possible to do by WCF? I mean create two WCF services, but B service doesn't know nothing about A service.
Thank you解决方案Your description is vague but let me try :)
On machine B you deploy a service with contract like
[ServiceContract] interface IMyService{ [OperationContract] bool HasDataForB(); [OperationContract] Data GetData(); }
On machine A you call HasDataForB with certain interval and when it returns true you just call GetData().
Hello! Again all. Thanks for replying. I found solution here
Broadcasting Events with a Duplex WCF Service[^]
这篇关于如何在网络中通信两台机器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!