enwi / dartzmq

A simple dart zeromq implementation/wrapper around the libzmq C++ library
https://pub.dev/documentation/dartzmq/latest/
MIT License
26 stars 17 forks source link

Connect/Send no error message if server is not available #15

Closed alexanderwwagner closed 1 year ago

alexanderwwagner commented 1 year ago

Describe the Bug I try to use your library with the environment which I described below. If I call socket.connect and Socket.send if no Server is available there is no error message and no effect... so I can not detect, that something is not okay?

Environment OS: Archlinux 6.0.12-arch1-1 Android x86 emulator: Pixel 5 API 30 flutter: 3.3.9 compileSdkVersion 33 ndkVersion flutter.ndkVersion

To Reproduce

  // Send a test message
  // => via zmq
  testzmq() {
    // Tst
    final ZContext context = ZContext();
    final ZSocket socket = context.createSocket(SocketType.req);
    socket.connect("tcp://localhost:6555");
    //socket.sendString("Hello");
    socket.send([1, 2]);
    socket.close();
  }

Expected Behavior Error message if I can not connect to server / Get Stuck on server.connect

Reproducibility 100%

enwi commented 1 year ago

Hey @alexanderwwagner that behavior is to be expected. Please take a look at the official ZeroMQ documentation.

If you want to figure out if a socket is really connected to an endpoint please take a look at the monitor function. Though I think those methods need to be added to this library first.

alexanderwwagner commented 1 year ago

As far as I can remember, I thought there was a timeout at this point in the python library... But then I apparently got something wrong. I checked the behavior of the python library again... its the same. So thank you for your help I will have a look on the links.

enwi commented 1 year ago

@alexanderwwagner I have published a new version that introduces the ZMonitor and the MonitoredZSocket with which you can receive socket events that tell you the state of the socket