Click here to Skip to main content
15,860,972 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Comments
Sergey Alexandrovich Kryukov 2-Jan-15 10:25am    
Before asking such questions, you need to realize what you really want to achieve, to be able to explain it clearly, without "something like". The most uncertain part is "what A-machine knows about B-machine". Once you're connected, the direction of data flow just doesn't matter; it's up to you.
—SA
Hung, Han 2-Jan-15 11:09am    
Just because A sits behind a firewall doesn't really matter. If it has a valid IP address, then B can be configured to talk to A. If A has a NAT IP, then that's a different matter and A will most likely have to initiate the communication with B so that B will know where A is.

If we are talking about two machines sitting on the Internet, it's next to impossible for B (or A) to just send out a broadcast signal looking for A (or vice versa). It's just not practical because there are way too many IP addresses to loop through. Doable, but not practical.

As Sergey pointed out, once communication is established, the direction of data does not matter.
[no name] 2-Jan-15 14:17pm    
"A-machine behind firewall, B-machine doesn't know nothing about A-machine.""
"I need to send data from B-machine to A-machine."

How you can send something from B to A if B does not know A? To whom B should send something and how?
Sergey Alexandrovich Kryukov 2-Jan-15 15:52pm    
Apparently, A-machines knows something about B-machine. The question is way to vague to discuss anything seriously. Even "behind a firewall" needs some explanation: behind which side of firewall, where? :-)
—SA
Kschuler 2-Jan-15 15:17pm    
Perhaps more information would help you get more suggestions. For instance, you just say "send data". Are you talking about a chat application? Or databases interacting? Or what?

Your description is vague but let me try :)
On machine B you deploy a service with contract like
C#
[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().
 
Share this answer
 
Hello! Again all. Thanks for replying. I found solution here
Broadcasting Events with a Duplex WCF Service[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900