2021年3月9日星期二

How to use ZeroMQ ipc transport on windows 10

zeromq 4.3.3 added support for IPC on Windows 10 via AF_UNIX, but know how to use it? I tried using address ipc://foo, ipc://D:\Tmp\11.txt and ipc://D:\Tmp\ but neither works.

I have ensured AF_UNIX available by using cmd command sc query afunix, here is output:

SERVICE_NAME: afunix      TYPE               : 1  KERNEL_DRIVER      STATE              : 4  RUNNING                              (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)      WIN32_EXIT_CODE    : 0  (0x0)      SERVICE_EXIT_CODE  : 0  (0x0)      CHECKPOINT         : 0x0      WAIT_HINT          : 0x0  

My demo code which output Assertion failed: rc == 0 ...:

#include <zmq.h>  #include <string.h>  #include <stdio.h>  #include <assert.h>    int main(void)  {      printf("%d.%d.%d\n", ZMQ_VERSION_MAJOR,ZMQ_VERSION_MINOR,ZMQ_VERSION_PATCH);      //  Socket to talk to clients      void* context = zmq_ctx_new();      void* responder = zmq_socket(context, ZMQ_REP);        int rc = zmq_bind(responder, "ipc://foo");      assert(rc == 0);        while (1)      {          char buffer[10];          zmq_recv(responder, buffer, 10, 0);          printf("Received Hello\n");          zmq_send(responder, "World", 5, 0);      }      return 0;  }  
https://stackoverflow.com/questions/66558178/how-to-use-zeromq-ipc-transport-on-windows-10 March 10, 2021 at 12:02PM

没有评论:

发表评论