Ok, I solved the problem using Zero MQ library.
Node A, the publisher:
import zmq, time
from datetime import datetime
context = zmq.Context()
#create this node as publisher
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:25647")
for i in range(300):
message = ("%d, %d" % (1, i))
print str(datetime.now().time()) + "> sending: " + message
socket.send(message)
time.sleep(1)
Node B, the receiver:
import zmq, time
from datetime import datetime
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect("tcp://localhost:25647")
#filter message for particular subscriber ('1')
socket.setsockopt(zmq.SUBSCRIBE, '1')
while True:
message = socket.recv()
print(str(datetime.now().time()) + "> received: " + str(message))
This setting does what I wanted, that is, it conveys signal from one program to another and it does it in quite good time (this very simple message, tuple of two integers, is sent in around 0.5 ms).
Two important things:
- subscribe have to be "authorized" to receive message - it is done by filtering the first value of message
- publisher is "binding", subscriber "connecting" to socket