when they say sockets on steroids, I'm inclined to believe them.
I've included builds for windows x86 and linux x64ØMQ (zeromq)
The socket library that acts as a concurrency framework.
Carries messages across inproc, IPC, TCP, and multicast.
Connect N-to-N via fanout, pubsub, pipeline, request-reply.
Asynch I/O for scalable multicore message-passing apps.
there are windows dll's available off the zeroqm.org
loads of examples and online guide
http://zguide.zeromq.org/page:all
ØMQ download
Example of client
Code: Select all
IncludeFile "zmq.pbi"
Procedure main()
Debug "Connecting to hello world server..";
context = zmq_ctx_new ();
requester = zmq_socket (context, #ZMQ_REQ);
zmq_connect (requester, @"tcp://localhost:5555");
For request_nbr = 0 To 10
buffer.s = Space(10);
Debug "Sending Hello " + Str(request_nbr)
zmq_send (requester, @"Hello", 5, 0);
zmq_recv (requester, @buffer, 10, 0); blocks untill recieved
Debug "Received " + buffer
Next
zmq_close (requester);
zmq_ctx_destroy (context);
EndProcedure
If Init_zmq(zmqlibpath)
main()
EndIf
Code: Select all
IncludeFile "zmq.pbi"
Procedure worker(context)
Protected reciver,buf.s
receiver = zmq_socket (context, #ZMQ_REP);
zmq_connect (receiver, @"inproc://workers");
While 1
buf.s = Space(10)
zmq_recv(receiver,@buf,10,0)
Delay(1);
zmq_send(receiver,@"World",5,0)
Wend
zmq_close (receiver);
EndProcedure
Procedure main()
context = zmq_ctx_new ();
clients = zmq_socket (context, #ZMQ_ROUTER);
zmq_bind (clients, @"tcp://*:5555");
workers = zmq_socket (context, #ZMQ_DEALER);
zmq_bind (workers, @"inproc://workers");
For thread_nbr = 0 To 5
tworker = CreateThread(@worker(),context)
Next
zmq_proxy (clients, workers, #Null);
;// example never gets here, but clean up anyhow
zmq_close (clients);
zmq_close (workers);
zmq_ctx_destroy (context);
EndProcedure
If Init_zmq(zmqlibpath)
main()
EndIf