Changing ipc: // in tcp: // python zmq (Windows)

I am trying to get a python application running on windows and I am getting ZMQError: protocol not supported which is because ipc is not supported on windows. From what I've read, going from ipc to tcp should be as easy as changing the line 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 I change ipc: // to tcp: // I get ZMQError: invalid argument, so I think it is not that easy. Could you please walk through the process of getting this fix for windows or tell me if I'm asking a stupid question.

You can see the full script https://github.com/sailfish-team/sailfish/blob/master/sailfish/master.py the above code from line 250. SailfishCFD - Patton Lattice Boltzmann (LBM) Simulation Package for GPUs (CUDA , OpenCL)

Many thanks!

+3


source to share


1 answer


ZeroMQ is a transport agnostic

This means that messages can be sent regardless of which transport class is being { inproc:// | ipc:// | tcp:// | pgm:// | epgm:// }

used under the hood.

This does not mean that the same (transport-specific) addressing syntax will work anyway.

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 does not allow the use of the transport class ipc:

. This need for a change will affect the broader scope of your source code, as there are some additional ipc-related assumptions when accessed.

As seen from:

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?

      

Begin with:

cropping problem. Your code uses the variable "filename" -file-naming (addressing) for IPC pipes. There you start.



try:
     print                                   "DEBUG: Try to .bind() a ", master_addr
     sock.bind( master_addr )
     print                                   "     ==OK."

except ZMQError as Exc:
     print                                   "     ! FAILED:"
     # log & handle Exc details

except:
     print                                   "     ! FAILED: a non-ZMQ-related issue"
     # log & handle Exc details

      

Port # -s:

Make sure you are not using the zmq.bind () command on Windows to hit " priviliged ". /already/ firewall - blocked "TCP port # -s.

By checking these system settings and making the zmq-call (s) syntax compatible with the ZeroMQ API for the transport class, tcp://

i.e:.

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

# asString

or

"tcp://<aDnsResolvableHostNAME>:<port#>"

# asString

you have.

+4


source







All Articles