zeromq

JRubyでffi-rzmqを動かす

Macでjruby+ffi-rzmqを使う時 libc.dylibが無いというエラー /usr/libにLD_LIBRARY_PATHを通す zmq.dylibのアーキテクチャが違うというエラー zmqを64bitでインストールして、環境変数JAVA_OPTSに-d32を付けていると起こる このあたりハマる。 MacのJRubyの…

zeromqをwindowsにインストール

http://www.zeromq.org/docs:windows-installationsmsysgitインストールしてから、 cd ~/ mkdir tmp cd tmp git clone git://github.com/zeromq/zeromq2.gitbuilds/msvc/msvc.slnをvisual studio 2008 express(お金かからないやつ)でビルドした。ここまで…

Cでsub

sub.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <zmq.h> #include <assert.h> #define MSG_SIZE 128 int main(int argc, char **argv){ printf("sub start\n"); int rc; void *ctx, *sock; zmq_msg_t msg; assert(ctx = zmq_init(1)); assert(sock = zmq_socket(ctx, ZMQ_SUB)</assert.h></zmq.h></string.h></stdlib.h></stdio.h>…

ZeroMQ C++でsub

http://api.zeromq.org/zmq_cpp.htmlこれを #!/usr/bin/env ruby require 'rubygems' require 'zmq' ctx = ZMQ::Context.new sock= ctx.socket(ZMQ::SUB) sock.connect('tcp://127.0.0.1:5000') sock.setsockopt(ZMQ::SUBSCRIBE, 'count') loop do puts sock…

今度こそZeroMQ C++ bindingからpubする

http://d.hatena.ne.jp/shokai/20100811/1281492751 のC++ binding版 Cの関数のラッパーなので先にCで試してからだったら照らし合わせて(http://api.zeromq.org/zmq_cpp.html)理解が早かった pub.cpp #include <stdio.h> #include <iostream> #include <string> #include <zmq.hpp> #include <boost/format.hpp> usi</boost/format.hpp></zmq.hpp></string></iostream></stdio.h>…

C言語からRubyへ送る

参考:http://www.zeromq.org/docs:cookbook C++ bindingの使い方がいまいちわからなかったのでCのを使っているpub.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <zmq.h> #include <assert.h> int main(int argc, char **argv){ printf("pub start\n"); int rc; void *ctx, *soc</assert.h></zmq.h></string.h></stdlib.h></stdio.h>…

zeromqインストール、twitter stream APIを中継

ぜろむきゅー wget http://www.zeromq.org/local--files/area:download/zeromq-2.0.7.tar.gz tar -zxvf zeromq-2.0.7.tar.gz cd zeromq-2.0.7 ./configure make sudo make installソースから入れてるのはC++ binding目当て それからgem入れる sudo gem insta…