GithubHelp home page GithubHelp logo

lua-zmq's People

Contributors

iamaleksey avatar jsimmons avatar norman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lua-zmq's Issues

provide tag or archive

Please provide a tag or an archive for lua-zmq repository, possibly one with the version as numeric value in it.

Memory usage

After running publisher.lua and subscriber.lua for a while I see that the lua running subscriber.lua is using more and more memory. Is there something that needs to be freed somewhere or is this a genuine leak?

Thanks

Examples cliente.lua and server.lua does nothing wint zeromq 2.0.10

I've downloaded and installed zeromq 2.0.10 and the lua binding on both win32 and linux and on both I have the same reult:
client.lua and server.lua start and sit there waiting forever without any sign of life and I use ctrl-c to finish then.
Is this an issue someone else is experimenting ?

[Solved] Compiling against luajit?

I can't get the bindings to work with luajit. Tried to:

gcc -I/usr/local/include/luajit-2.0/ -o zmq.lo -c -pthread -fPIC -Wall -O2 zmq.c
gcc -shared -lzmq -lluajit-51 zmq.lo -o zmq.so

requiring zmq gives the following error:

dlopen(/usr/local/lib/lua/5.1/zmq.so, 2): Library not loaded: libluajit.so

EDIT: Additional compilation flags and prober libluajit renaming are need for Mac OS

[patch] fixed socket options

diff --git a/zmq.c b/zmq.c
index 70ce0d2..1343feb 100644
--- a/zmq.c
+++ b/zmq.c
@@ -119,10 +119,10 @@ static int Lzmq_setsockopt(lua_State *L)
     int rc = 0;

     switch (option) {
-    case ZMQ_HWM:
-    case ZMQ_LWM:
     case ZMQ_SWAP:
-    case ZMQ_AFFINITY:
+    case ZMQ_RATE:
+    case ZMQ_RECOVERY_IVL:
+    case ZMQ_MCAST_LOOP:
         {
             int64_t optval = (int64_t) luaL_checklong(L, 3);
             rc = zmq_setsockopt(s->ptr, option, (void *) &optval, sizeof(int64_t));
@@ -137,9 +137,8 @@ static int Lzmq_setsockopt(lua_State *L)
             rc = zmq_setsockopt(s->ptr, option, (void *) optval, optvallen);
         }
         break;
-    case ZMQ_RATE:
-    case ZMQ_RECOVERY_IVL:
-    case ZMQ_MCAST_LOOP:
+    case ZMQ_HWM:
+    case ZMQ_AFFINITY:
     case ZMQ_SNDBUF:
     case ZMQ_RCVBUF:
         {
@@ -168,12 +167,14 @@ static int Lzmq_getsockopt(lua_State *L)
     int rc = 0;

     switch (option) {
-    case ZMQ_HWM:
-    case ZMQ_LWM:
     case ZMQ_SWAP:
-    case ZMQ_AFFINITY:
+    case ZMQ_RATE:
+    case ZMQ_RECOVERY_IVL:
+    case ZMQ_MCAST_LOOP:
+    case ZMQ_RCVMORE:
         {
             int64_t optval;
+            optvallen = sizeof(int64_t);
             rc = zmq_getsockopt(s->ptr, option, (void *) &optval, &optvallen);
             if (rc == 0) {
                 lua_pushinteger(L, (lua_Integer) optval);
@@ -181,18 +182,26 @@ static int Lzmq_getsockopt(lua_State *L)
             }
         }
         break;
-    /* case ZMQ_IDENTITY:
-     * case ZMQ_SUBSCRIBE:
-     * case ZMQ_UNSUBSCRIBE:
-     */
-    case ZMQ_RATE:
-    case ZMQ_RECOVERY_IVL:
-    case ZMQ_MCAST_LOOP:
+    case ZMQ_IDENTITY:
+        {
+            char id[256];
+            memset((void *)id, '\0', 256);
+            optvallen = 256;
+            rc = zmq_getsockopt(s->ptr, option, (void *)id, &optvallen);
+            id[255] = '\0';
+            if (rc == 0) {
+                lua_pushstring(L, id);
+                return 1;
+            }
+        }
+        break;
+    case ZMQ_HWM:
+    case ZMQ_AFFINITY:
     case ZMQ_SNDBUF:
     case ZMQ_RCVBUF:
-    case ZMQ_RCVMORE:
         {
             uint64_t optval;
+            optvallen = sizeof(uint64_t);
             rc = zmq_getsockopt(s->ptr, option, (void *) &optval, &optvallen);
             if (rc == 0) {
                 lua_pushinteger(L, (lua_Integer) optval);
@@ -344,7 +353,6 @@ LUALIB_API int luaopen_zmq(lua_State *L)
     set_zmq_const(DOWNSTREAM);

     set_zmq_const(HWM);
-    set_zmq_const(LWM);
     set_zmq_const(SWAP);
     set_zmq_const(AFFINITY);
     set_zmq_const(IDENTITY);

macports build file

Hopefully someone will find this gist useful:

http://gist.github.com/450180

diff --git a/Makefile b/Makefile
index 5f89db2..41465f0 100644
--- a/Makefile
+++ b/Makefile
@@ -18,9 +18,9 @@

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

THE SOFTWARE.

-CFLAGS = pkg-config lua5.1 --cflags -fPIC -O3 -Wall
-LFLAGS = -shared pkg-config --libs --cflags libzmq
-INSTALL_PATH = pkg-config lua5.1 --variable=INSTALL_CMOD
+CFLAGS = -fPIC -O3 -Wall -I/opt/local/include
+LFLAGS = -shared -L/opt/local/lib -llua -lzmq
+INSTALL_PATH = /opt/local/lib

all: zmq.so
@@ -35,7 +35,7 @@ zmq.so: zmq.lo

install: zmq.so

  •   install -D -s zmq.so $(INSTALL_PATH)/zmq.so
    
  •   install  zmq.so  $(INSTALL_PATH) 
    

    clean:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.