Ok So after taking your advice to use the PUB/SUB, here´s a revised version of 
my code. It doesn´t give me an error now but the page just keeps loading 
endlessly without any message displayed. 


$context = new ZMQContext();
echo "Collecting data from the MDT server\n";
$subscriber = new ZMQSocket($context, ZMQ::SOCKET_SUB);
$subscriber->connect("tcp://24.187.208.22:2060");
$subscriber->setSockOpt(ZMQ::SOCKOPT_SUBSCRIBE);
//while(true){
    $string = $subscriber->recv();
    echo $string;
//}

 
Does it matter that i´m running this on my localhost?

Regards,
Olanrewaju Lawal
Web Developer / Programmer
+2348053568948



________________________________
From: Amr Ali <amr.ali...@gmail.com>
To: ZeroMQ development list <zeromq-dev@lists.zeromq.org>
Sent: Wednesday, October 12, 2011 12:41 AM
Subject: Re: [zeromq-dev] PHP Error on Ubuntu

It depends on what he wants to do, if he wants to have several sockets receiving
the same message, he then should use PUB/SUB, otherwise PUSH/PULL pattern should
work smoothly.

PUB/SUB should work in a setup that looks like this ...

[Publisher]
     -
     -
     ------> [Subscriber]
     -
     ------> [Subscriber]
     -
     ------> [Subscriber]

In that setup *all* the subscribers receive the *same* message the publisher
sends. Think RSS.

PUSH/PULL should work in a setup more similar to this ...

[Pusher]
    .
    .
    ......> [Puller]
    ......> [Puller]
    ......> [Puller]

Where only *one* of the pullers will receive the message and other's won't, this
works best if you want an LRU functionality (think load-balancer).

On 10/12/2011 01:27 AM, Mikko Koppanen wrote:
> On Wed, Oct 12, 2011 at 12:24 AM, lanre lawal <lawillas4e...@yahoo.com> wrote:
>> Hello Ali,
>>       Well for what iḿ trying to achieve I really don´t need to send any
>> messages, All i need to do is receive the messages so am thinking maybe the
>> send() part would have to go off. The documentation site is currently down
>> so I can´t access the documentation. Is there a soft copy of the
>> documentation that I can get from somewhere else. Maybe you can help me from
>> your experience. I´ll explain what I actually want to achieve.
>>
>> There´s a dedicated IP address that is currently receiving messages from
>> some devices, now I want to connect to this address and receive these
>> messages. Thats just what I want to do. Can you give me steps on how to do
>> this or better still send me a soft copy of the documentation.
> 
> Hi,
> 
> if you want to just receive message then REQ/REP is the wrong pattern
> for you. You should use PUB/SUB for this scenario. The
> http://zguide.zeromq.org/ contains examples in PHP as well.
> 
> -- mikko
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to