Пример #1
0
def sender(uniq):
    global done
    s = NitroSocket()
    s.connect("tcp://127.0.0.1:4445")

    for x in xrange(100000):
        fr = NitroFrame(uniq + str(x))
        s.send(fr)
        fr = s.recv()
        assert(fr.data == "mega" + uniq + str(x))

    print uniq, "done!"
    done += 1
Пример #2
0
from pynitro import NitroSocket, NitroFrame
import time
import select

ns = NitroSocket(want_eventfd=True)
ns.bind("tcp://127.0.0.1:7723")

select.select([ns], [], [])
fr = ns.recv(NitroSocket.NOWAIT)
print fr
print fr.data
ns.send(NitroFrame("my only sunshine"))
select.select([ns], [], [])
fr = ns.recv(NitroSocket.NOWAIT)
print fr
print fr.data
ns.send(NitroFrame("when skies are gray"))
time.sleep(4)