ØMQ, also written as ZeroMQ or 0MQ, is an open source (LGPL) [http://www.zeromq.org/] socket/messaging framework. There is a Tcl binding [https://github.com/zeromq/zeromq1/blob/master/libtclzmq/zmq.c] for V1.0. Bindings for version 2.1, 2.2 and 3.1 can be found at http://github.com/jdc8/tclzmq A publishing example, also found in the ZeroMQ http://zguide.zeromq.org/page:all#Getting-the-Message-Out%|%Guide%|%: ====== # # Weather update server # Binds PUB socket to tcp:#*:5556 # Publishes random weather updates # package require zmq # Prepare our context and publisher zmq context context zmq socket publisher context PUB publisher bind "tcp://*:5556" publisher bind "ipc://weather.ipc" # Initialize random number generator expr {srand([clock seconds])} while {1} { # Get values that will fool the boss set zipcode [expr {int(rand()*100000)}] set temperature [expr {int(rand()*215)-80}] set relhumidity [expr {int(rand()*50)+50}] # Send message to all subscribers set data [format "%05d %d %d" $zipcode $temperature $relhumidity] if {$zipcode eq "10001"} { puts $data } zmq message msg -data $data publisher send_msg msg msg close } publisher close context term ====== with corresponding client: ====== # # Weather update client # Connects SUB socket to tcp:#localhost:5556 # Collects weather updates and finds avg temp in zipcode # package require zmq # Socket to talk to server zmq context context zmq socket subscriber context SUB subscriber connect "tcp://localhost:5556" # Subscribe to zipcode, default is NYC, 10001 if {[llength $argv]} { set filter [lindex $argv 0] } else { set filter "10001" } subscriber setsockopt SUBSCRIBE $filter # Process 100 updates set total_temp 0 for {set update_nbr 0} {$update_nbr < 100} {incr update_nbr} { zmq message msg subscriber recv_msg msg lassign [msg data] zipcode temperature relhumidity puts [msg data] msg close incr total_temp $temperature } puts "Averate temperatur for zipcode $filter was [expr {$total_temp/$update_nbr}]F" subscriber close context term ====== ---- '''[AK] - 2012-04-04 16:24:27''' Does this mean that [GSoC Idea: Updated Tcl bindings for ZeroMQ] is out of date ? ---- '''[jdc] - 2012-04-04 18:50:34''' I guess so. All ZeroMQ commands are wrapped and most of the examples are ported to Tcl. Still work to do to make the package thread safe, to improve the asynchronous processing of messages, and on examples found in chapter 5 of the ZeroMQ guide. <>Interprocess Communication