[zeromq-dev] XREQ/XREP messaging flow
Umut Aydin
aydinumut82 at gmail.com
Tue Oct 25 12:23:38 CEST 2011
Hello again everyone,
I have read first 3 chapters again and now I have better understanding on
some of features but I still don't get that one thing.
https://github.com/imatix/zguide/blob/master/examples/Python/syncpub.py
https://github.com/imatix/zguide/blob/master/examples/Python/syncsub.py
In these examples, there is a basic combination of using a sync signal on
pub/sub pattern. Basically my code does same thing at the beginning. Then I
try to respond via server socket instead of publisher. As Pieter said,
messages couldn't receive that way. Right after reading the guide (and of
course Pieter mentioned ROUTER/DEALER) I tried to implement a
broker(XREP/XREQ) between server(REP) and client(REQ) just like in that
example:
https://github.com/imatix/zguide/blob/master/examples/Python/rrbroker.py
I don't think that I need to implement a broker to respond a request via
same socket but in that version, frontend could receive data from client but
there was no message on backend and of course there was no message on server
which is supposed to receive messages from backend. Here, each examples have
one type of pattern which uses two-way communication. In my case, there are
2 types of pattern which uses two way communication.
One more thing about the communication, in my original code, I send
player-init request when client started but on the other side I receive
those 2 different lines. I'm not sure if that changes anything but I also
don't know where unreadable line comes from.
> �����NK{���nц9�
> {"cmd":"player-init","arg":null}
Could someone separate a few minutes to explain what I'm missing here?
Here is my example: http://pastebin.com/Ym0qxjgX
On Mon, Oct 24, 2011 at 12:42 PM, Umut Aydin <aydinumut82 at gmail.com> wrote:
> Hello Pieter,
>
> I'm working on it. Thank you
> -Umut
>
> On Sun, Oct 23, 2011 at 5:05 PM, Pieter Hintjens <ph at imatix.com> wrote:
>
>> Umut,
>>
>> Please read the Guide until at least chapter 3, where it explains how
>> DEALER/ROUTER sockets work.
>>
>> You're not using the ROUTER/XREP socket correctly, so messages are
>> being dropped.
>>
>> -Pieter
>>
>> On Sun, Oct 23, 2011 at 4:27 AM, Umut Aydin <aydinumut82 at gmail.com>
>> wrote:
>> > Hello everyone,
>> > I'm trying to make a small game server demo with ZeroMQ and I have a
>> problem
>> > with my XREQ/XREP sockets.
>> > http://pastebin.com/Ym0qxjgX
>> > As you can see in sample source code, it looks like basic sync pub/sub
>> > example of python binding. In example, server sends responses through
>> > publisher socket and it works. It's OK with my code too but I need to
>> use
>> > server socket at least for one response.
>> > If you run my code you'll see that server socket can receive 'WhoAmI'
>> > request and calls send method. To see that please cut 'print data' and
>> > paste it to the line right after 'if' condition.
>> > The problem here is that client socket cannot receive the response. If I
>> use
>> > publisher socket instead of server to respond, then client can receive
>> the
>> > response correctly. Of course you should change 'client.receive' to
>> > 'subscriber.receive' to perform that.
>> > I have all game-related classes completed and tested via PUB/SUB
>> messaging
>> > but I cannot get that single response received by my XREQ socket.
>> > Do I miss something in my code? Any idea?
>> > By the way, right after solving that problem, I'll make subscriber and
>> > client loops work in different multiprocessing.Process
>> > I tried to implement that now and I couldn't get any response but I
>> guess it
>> > was based on same problem.
>> > Thank you.
>> > -Umut
>> > _______________________________________________
>> > zeromq-dev mailing list
>> > zeromq-dev at lists.zeromq.org
>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >
>> >
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>
>
>
>
>
--
Best Regards,
Umut Aydin
http://about.me/umutaydin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111025/847cf607/attachment.htm>
More information about the zeromq-dev
mailing list