Demonstrates some simple zmq communication
Similar to this example but usable more generally.
Quoting http://zeromq.org/area:faq:
Can I subscribe to messages using regex or wildcards?
| # Makefile template for shared library | |
| CC = gcc # C compiler | |
| CFLAGS = -fPIC -Wall -Wextra -O2 -g # C flags | |
| LDFLAGS = -shared # linking flags | |
| RM = rm -f # rm command | |
| TARGET_LIB = libtarget.so # target lib | |
| SRCS = main.c src1.c src2.c # source files | |
| OBJS = $(SRCS:.c=.o) |
| # coding=utf-8 | |
| """ | |
| LICENSE http://www.apache.org/licenses/LICENSE-2.0 | |
| """ | |
| import datetime | |
| import sys | |
| import time | |
| import threading | |
| import traceback | |
| import SocketServer |
| //DNS Query Program on Linux | |
| //Author : Silver Moon ([email protected]) | |
| //Dated : 29/4/2009 | |
| //Header Files | |
| #include<stdio.h> //printf | |
| #include<string.h> //strlen | |
| #include<stdlib.h> //malloc | |
| #include<sys/socket.h> //you know what this is for | |
| #include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc |
| { | |
| "require": { | |
| "slim/slim": "2.*", | |
| "illuminate/database": "*", | |
| "dhorrigan/capsule": "*" | |
| } | |
| } |
Demonstrates some simple zmq communication
Similar to this example but usable more generally.
Quoting http://zeromq.org/area:faq:
Can I subscribe to messages using regex or wildcards?
Table of Contents generated with DocToc
Here at Glitterbug Tech, Django is the lifeline of everything we make and we are big fans! Django doesn't get in the way and lets us write the language we love, python, while providing an amazing set of tools that makes creating web applications fast and fun. But, as you know, code is executed synchronously before you can send back a response. Which means when you are generating that report from your database which has a million rows, your client has to wait for a response while your application huffs and puffs trying to get everything ready (Unless he times out, in which case you receive angry calls while you try to explain what "502 Bad Gateway" means). Sometimes you just want to make your site more responsive by pushing time consuming tasks in the background ("Your comment has been posted!" while a zmq process works in the backend adding it to your db/caching layer/pushing it to followers/creating rainbows). Wha
| # coding=utf8 | |
| # Copyright (C) 2011 Saúl Ibarra Corretgé <[email protected]> | |
| # | |
| import hashlib | |
| import os | |
| import re | |
| import socket | |
| import struct |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <czmq.h> | |
| #include <zmq.h> | |
| int main(int argc, char *argv[]) { | |
| zctx_t *ctx = zctx_new(); | |
| void *dealer = zsocket_new(ctx, ZMQ_DEALER); | |
| zsocket_connect(dealer, "tcp://localhost:%d", 2222); |
| # encoding: utf-8 | |
| import zmq | |
| from collections import defaultdict | |
| context = zmq.Context() | |
| client = context.socket(zmq.ROUTER) | |
| client.bind("tcp://*:5556") | |
| poll = zmq.Poller() |