ahkzmq is an AutoHotkey_L wrapper for zeromq.
https://autohotkey.com/board/topic/79218-zeromq-class/ https://github.com/tinku99/ahkzmq
zeromq is a socket library that:
- Carries messages across inproc, IPC, TCP, and multicast.
- Connect N-to-N via fanout, pubsub, pipeline, request-reply.
- supports interaction between 30+ languages including C, C++, Java, .NET, Python, and now autohotkey!
- rep/req example from the zguide
#singleinstance off
z := zstart("tcp://localhost:5555")
omsg := ["hello", "from", "autohotkey"]
msg := zsendrcv(z, omsg)
loop % msg.count{
msgbox % msg[A_Index]
}
return
f2::
zsendrcv(z, omsg)
return
;; hotkeys
!r::reload
!q::exitapp
;; includes
#include lib\zmq.ahk
#include lib\json.ahk
hwjsonserver.py
import zmq
import time
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:5555")
while True:
# Wait for next request from client
message = socket.recv_json()
print "Received request: ", message
socket.send_json({"count": 2, 1: "echo" , 2: " from server"})
the tcp class, example from the german forum inspired me to take another crack at zeromq in ahk.