bitcoin/bitcoin — pull request #2415 by fredan (2013-03-27 20:55:05+00:00)
Title: 0mq - Zero MQ Support.

Using a publisher socket to publish three things when they are
happening in the Bitcoin client:

1) New transactions
2) New blocks
3) New ipaddresses

This way there are no need to ask the bitcoin client if something
new has happen. You will be notified!

To compile:

USE_ZMQ=1 make -f makefile.unix

To run:

bitcoind -zmqpubbind="ipc://.bitcoin.pub"

A Python client that will print all the information:

[CODE]
import zmq

def main():

context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.setsockopt(zmq.SUBSCRIBE, "")
socket.connect("ipc://.bitcoin.pub")

while True:
msg = socket.recv()
print "%s" % (msg[8:])

if __name__ == '__main__':
main()
[/CODE]

For more commandline options, see bitcoind --help.