[zeromq-dev] How to open a socket on a real file ?
Laurent Alebarde
l.alebarde at free.fr
Tue Jun 4 12:18:41 CEST 2013
Hi list,
In the presentation of Ian Barber, there is a PHP example where the
socket is a file descriptor on the standard input.
$ctx = new ZMQContext();
$sock = $ctx->getSocket(ZMQ::SOCKET_PULL);
$sock->bind("tcp://*:5555");
$fh = fopen("php://stdin", 'r');
$poll = new ZMQPoll();
$poll->add($sock, ZMQ::POLL_IN);
$poll->add($fh, ZMQ::POLL_IN);
while(true) {
$events = $poll->poll($read, $write);
if($read[0] === $sock) {
echo "ZMQ: ", $read[0]->recv();
} else {
echo "STDIN: ", fgets($read[0]);
}}
I have not find anything on that in the documentation. I would need more
information please, especially to transfer a file from one process to an
other, possibly with streaming, in C.
Cheers,
Laurent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130604/289f089f/attachment.htm>
More information about the zeromq-dev
mailing list