Tuesday 15 January 2013

changing ipc:// to tcp:// python zmq (Windows) -



changing ipc:// to tcp:// python zmq (Windows) -

i't trying python application running on windows , zmqerror: protocol not supported because ipc not supported on windows. have read alter ipc tcp protocol should easy changing string used in bind().

master_addr = 'ipc://{0}/sailfish-master-{1}_{2}'.format( tempfile.gettempdir(), os.getpid(), subdomain.id) ipc_files.append(master_addr.replace('ipc://', '')) sock = ctx.socket(zmq.pair) sock.bind(master_addr) sockets.append(sock)

if alter ipc:// tcp:// zmqerror: invalid argument guess not simple. walk me through process of getting fixed windows, or tell me if i'm asking stupid question.

you can see total script https://github.com/sailfish-team/sailfish/blob/master/sailfish/master.py code above line 250. sailfishcfd python lattice boltzmann (lbm) simulation bundle gpus (cuda, opencl)

thank much!

zeromq transport agnostic

that means, 1 may pass messages irrespective of transport-class { inproc:// | ipc:// | tcp:// | pgm:// | epgm:// } beingness used "under-the-hood".

that not mean same ( transport-specific ) addressing syntax work in either case.

master_addr = 'ipc://{0}/sailfish-master-{1}_{2}'.format( tempfile.gettempdir(), os.getpid(), subdomain.id ) sock.bind( master_addr ) # works on linux/ipc # .bind( <<<tcp_addr>>> ) # fails on "{0}{1}{2}".format-addressing"

windows not allow using ipc: transport-class. such need-to-change influence bit wider scope of source code, there additional ipc-related assumptions on addressing.

as seen in:

addr = "tcp://{0}".format( self._subdomain_addr_map[nbid] ) # tcp://<ip>:<port>? addr = "tcp://{0}".format( self._iface ) # ref. #104 missing ":<port>" part! summary_addr = 'tcp://127.0.0.1:{0}'.format( config._zmq_port ) # port free? start with:

framing issue. code uses variable "filename"-alike naming ( addressing ) ipc-pipes. there start.

try: print "debug: seek .bind() ", master_addr sock.bind( master_addr ) print " ==ok." except zmqerror exc: print " ! failed:" # log & handle exc details except: print " ! failed: non-zmq-related issue" # log & handle exc details port#-s:

be sure not command zmq.bind() on windows touch "priviliged" / already-used / firewall-"blocked" tcp-port#-s.

having checked these scheme settings & having made zmq-call(s) syntax compatible zeromq api tcp:// transport-class,

i.e.:

"tcp://<ip_address>:<port#>" # asstring

or

"tcp://<adnsresolvablehostname>:<port#>" # asstring

you have it.

python tcp ipc zeromq

No comments:

Post a Comment