[python-win32] zmq under win32service

momchil at bojinov.info momchil at bojinov.info
Mon Mar 7 17:08:03 EST 2022


Hello,

 

I m trying to serve 0mq listener under win32 service

Code works fine while in interactive session

 

Client:

import zmq, json

context = zmq.Context()

socket = context.socket(zmq.REQ)

socket.connect('ipc://cache/mm')

socket.send_json(json.dumps({"2" : "1"}))

message = socket.recv_json()

print(message)

 

server:

import zmq, json

context = zmq.Context()

socket = context.socket(zmq.REP)

socket.bind('ipc://cache/mm')

while True:

               message = socket.recv_json()

               print(message)

               socket.send_json(json.dumps({"data" : "BLA BLA"}))

 

Once I start the service though I can't send/receive content

Both service and cmd/client run under the same account (not SYSTEM)

 

I was wondering if I can even use while True without the spawning a separate
thread for it ?

 

I m using the service code from:

https://stackoverflow.com/questions/55677165/python-flask-as-windows-service

(And the service skeleton win32_service.py)

 

Help appreciated

 

Momchil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20220308/d1fe4e35/attachment.html>


More information about the python-win32 mailing list