JustinTulloss / zeromq.node

Node.js bindings to the zeromq library
MIT License
1.65k stars 284 forks source link

Testing simple server/client send nothing happens !? #80

Open lundin opened 12 years ago

lundin commented 12 years ago

Hi,

I sudo npm install zmq-3.0 and followed the install instructions for Zmq 3.1 as specified per shripadk.

I changed the simple-server.js and simple-client (in the example folder) to the require (zmq-3.0) and try to run it: nothing happens, the server would log the sended message no ?

I had to change the

s.bind('tcp://127.0.0.1:5554', function(err)

to s.bindSync to make it even start without segmention fault warning. But i dont get the ready to go or callback alert on message.

I am on node v0.7.0-pre

shripadk commented 12 years ago

I haven't tested it on node v0.7.0-pre. Works on v0.6.x. can you paste the entire code? What is the exact error so I can reproduce it?

lundin commented 12 years ago

Hi shripadk,

I think there is something i am missing.

pontus@ubuntu:~/node/node_modules/zmq-3.0/examples$ node simple-server.js Segmentation fault

Is the only error i get. There is a issue listed in the history that has the segmentation fault as well where the binding.node couldnt find the libzmq.so in usr/local/lib but when doing ldd i get this:

ldd node/node_modules/zmq-3.0/binding.node linux-vdso.so.1 => (0x00007fff9bd70000) libzmq.so.3 => /usr/local/lib/libzmq.so.3 (0x00007fa19e9f2000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa19e6eb000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa19e4d4000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa19e135000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa19df2d000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa19dd0f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa19da8b000) /lib64/ld-linux-x86-64.so.2 (0x00007fa19ee50000)

Btw

The simple-server example is

zmq = require('zmq-3.0'); util = require('util');

s = zmq.createSocket('rep');

s.bind('tcp://127.0.0.1:5554', function(err) { if (err) throw err; s.on('message', function(data) { util.puts("received data: " + data.toString('utf8')); s.send("Your message was received"); }); util.puts('Ready to go!'); });

lundin commented 12 years ago

shripadk,

i installed v0.6.5 with n and tried that

pontus@ubuntu:~/node/node_modules/zmq-3.0/examples$ n use 0.6.5 simple-server.js Ready to go!

So it is something with the bleding edge version of node indeed. Will you and TJ overlook this as we go or what will happen in the future ? Will your fork/patch be integrated in the ordinary zmq node branch ?

jdavidmitchell commented 12 years ago

I am having the same problem. zmq-2.0.1 node v0.6.10 zeromq-2.1.11

I ran: npm install -g zmq@2.0.1

ldd /usr/local/lib/node_modules/zmq/binding.node linux-vdso.so.1 => (0x00007fffd51ff000) libzmq.so.1 => /usr/local/lib/libzmq.so.1 (0x00007fe2ef12b000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fe2eef27000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fe2eec1f000) libm.so.6 => /lib64/libm.so.6 (0x00007fe2ee99b000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe2ee785000) libc.so.6 => /lib64/libc.so.6 (0x00007fe2ee405000) librt.so.1 => /lib64/librt.so.1 (0x00007fe2ee1fd000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe2edfe0000) /lib64/ld-linux-x86-64.so.2 (0x00007fe2ef57a000)

I use your example scripts, and for the producer, I get: node producer.js

node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'zmq' at Function._resolveFilename (module.js:332:11) at Function._load (module.js:279:25) at Module.require (module.js:354:17) at require (module.js:370:17) at Object. (/home/DMitchell/kata/producer.js:1:73) at Module._compile (module.js:441:26) at Object..js (module.js:459:10) at Module.load (module.js:348:31) at Function._load (module.js:308:12) at Array.0 (module.js:479:10)

lundin commented 12 years ago

jdavidmitchell,

Thanks for reporting about the .10 version.

But do you mean your npm the fork from shripadk ? The Error: Cannot find module 'zmq' sounds like you have a missmatch between the module name (the config name version) zmq-3.0 vs zmq. However i see that the bidning node is to the zmq. I havent tested again 0.6.10. neither.

jdavidmitchell commented 12 years ago

The problem was that I installed zmq globally, but node could not find zmq in /usr/local/lib/node_modules/ (even thought it was there, /usr/local/lib/node_modules/zmq/binding.node). I installed it locally in my $HOME directory, and it is working.

  1. export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  2. npm install zmq@2.0.1

David