-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No IPC Support for Windows, probably because of missing AF_UNIX support? #4677
Comments
In Windows 11 with the new 26 pyzmq version ipc seems to work. So this can be closed propably? import zmq
import os
import numpy as np
import logging
from multiprocessing import Process
# Configure logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
# Create a random numpy array of 1MB
array_size = 1 * 1024 * 1024 // 8 # 1MB of float64
random_array = np.random.rand(array_size)
# Save the array to a file
filename = 'random_array.npy'
np.save(filename, random_array)
logging.debug(f'Saved random array to {filename}')
# Define the IPC endpoint
ipc_endpoint = 'ipc://test_ipc.ipc'
def server():
logging.debug('Server: Starting...')
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind(ipc_endpoint)
logging.debug(f'Server: Bound to {ipc_endpoint}')
message = socket.recv()
logging.debug('Server: Received message')
# Save the received message to a numpy file
received_array = np.frombuffer(message, dtype=np.float64)
np.save('received_array.npy', received_array)
logging.debug('Server: Saved received array to received_array.npy')
# Load the original array from file
original_array = np.load(filename)
logging.debug('Server: Loaded original array from file')
# Load the received array from file
loaded_received_array = np.load('received_array.npy')
logging.debug('Server: Loaded received array from file')
# Compare the arrays
if np.array_equal(loaded_received_array, original_array):
socket.send_string("SUCCESS")
logging.info("SUCCESS for IPC")
logging.debug('Server: Arrays match. Sent SUCCESS to client')
else:
socket.send_string("FAILURE")
logging.debug('Server: Arrays do not match. Sent FAILURE to client')
def client():
logging.debug('Client: Starting...')
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect(ipc_endpoint)
logging.debug(f'Client: Connected to {ipc_endpoint}')
# Load the original array from file
original_array = np.load(filename)
logging.debug('Client: Loaded original array from file')
# Send the array as bytes
socket.send(original_array.tobytes())
logging.debug('Client: Sent data to server')
result = socket.recv_string()
logging.debug(f'Client: Received result from server: {result}')
return result
if __name__ == '__main__':
logging.debug('Main: Starting server and client processes')
server_process = Process(target=server)
server_process.start()
logging.debug('Main: Server process started')
client_process = Process(target=client)
client_process.start()
logging.debug('Main: Client process started')
client_process.join()
server_process.join()
logging.debug('Main: Server and client processes joined')
# Clean up the generated files
os.remove(filename)
os.remove('received_array.npy')
logging.debug('Main: Cleaned up generated files') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please use this template for reporting suspected bugs or requests for help.
Issue description
With pyzmq version 22.2.0 there was IPC supported in Windows, which I really am using a lot. This got probably dropped in 24.0.0
Question
Is there some link or info when this might get fixed within libzmq?
The text was updated successfully, but these errors were encountered: