'ZMQ : Receive from different computers
I have different computers publishing to master computer. And I have list of their IP addresses. The code below works fine when there is only one IP in the list, but when there is more than one IP it doesn't work. when trying "Try, except" It seems that it fails when trying to connect to the second index in the ipList.
PortNum = 6666
sockets = [len( ipList )]
pollers = [len( ipList )]
context = zmq.Context()
for nIdx in range( 0, len( ipList ) ):
ipAddr = ipList[nIdx]
sockets[nIdx] = context.socket( zmq.SUB )
sockets[nIdx].subscribe( '' )
strTCP = 'tcp://{0}:{1}'.format( ipAddr, usePortNum )
sockets[nIdx].connect( strTCP )
pollers[nIdx] = zmq.Poller()
pollers[nIdx].register(sockets[nIdx], zmq.POLLIN)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
