Qualcom Qualcom - 1 year ago 167
Python Question

Sending message with Router-Dealer Proxy using c# and python

I am able to have c# (client) and python (server) talk to each other by using a simple request-reply. However, I want my web application built on c# asp.net to be stable and need more clients and servers, so I tried connecting c# and python using the Router-Dealer Proxy with python.

I tried running the proxy python script first, then running c# (client), then python (server). However, when I run the python (server), it gives me an "Address in use" error message.

Am I running them in a wrong order OR is there something wrong with the proxy python script (shown below)?

5602 = c# client

5603 = python server

def main():

context = zmq.Context()

# Socket facing clients
frontend = context.socket(zmq.ROUTER)

# Socket facing services
backend = context.socket(zmq.DEALER)

zmq.proxy(frontend, backend)

# We never get hereā€¦

if __name__ == "__main__":

Answer Source

I'm assuming your servers use bind, so the proxy should connect to them rather than also using bind.

Note: in zeromq the order of application startup doesn't matter so you can tell your proxy to connect to a server that doesn't yet exist, when the server is started the connection will be made.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download