[en] Bidirectional services (solved)

Topics: Technical Support
Jan 12, 2015 at 5:16 PM
I am trying to create a project that has two components, both essentially servers.

I would like either server to be able to make an rpc call to the other server.

Only 1 server is publically accessible, the other is behind a NAT / firewall.

I have tried using client events but I cannot return any information from them (as discussed in other forum posts) so they are not suitable.

Is there anyway using, say the duplex tcp channel, to be both a host and a client at the same time using the same connection?

Thanks in advance

Nic
Coordinator
Jan 13, 2015 at 9:54 AM
Hi Nic,

basically, the answer is yes.
I've got a tiny console example of master/slave server application.
Slave server connects to the master server, and the client connects to the slave server:

client1 \
client2 → (slave1) → [master]
clientn /

Here is a gist: https://gist.github.com/yallie/5300068
Let me know if it helps.
 
Is there anyway using, say the duplex tcp channel, to be both a host and a client at the same time using the same connection?
 
Same connection? — no.
Each server has its own ZyanComponentHost and optional ZyanConnection for making calls to other servers.

Master server, hidden behind NAT: ZyanComponentHost (for handling slave server calls)
Slave server, publicly accessible: ZyanComponentHost (for handling client calls), ZyanConnection (for calling master server).