You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NetMQ Version: 4.0.1.13
Operating System: Windows 10
.NET Version: 8
Expected behaviour
In ZeroMQ, stream sockets send an empty message for peer connect / disconnect:
When a connection is made, a zero-length message will be received by the application. Similarly, when the peer disconnects (or the connection is lost), a zero-length message will be received by the application.
This seems not to be the case for NetMQ. The following code blocks on the first s1.ReceiveMultipartBytes()
[TestClass]
public class TestStreamSocket
{
[TestMethod]
public void TestConnectDisconnectMessages()
{
var s1 = new StreamSocket();
var port = s1.BindRandomPort("tcp://127.0.0.1");
var s2 = new StreamSocket();
s2.Connect($"tcp://127.0.0.1:{port}");
var connectMsg = s1.ReceiveMultipartBytes();
Assert.AreEqual(2, connectMsg.Count);
Assert.AreNotEqual(0, connectMsg[0].Length);
Assert.AreEqual(0, connectMsg[1].Length);
s2.Disconnect($"tcp://127.0.0.1:{port}");
var disconnectMsg = s1.ReceiveMultipartBytes();
Assert.AreEqual(2, connectMsg.Count);
Assert.AreNotEqual(0, connectMsg[0].Length);
Assert.AreEqual(0, connectMsg[1].Length);
}
}
ZeroMQ has a socket option ZMQ_STREAM_NOTIFY to enable (=1) or disable this behavior. Default is enabled (=1).
As an example, the following Python code uses libzmq and shows the expected behavior:
Environment
Expected behaviour
In ZeroMQ, stream sockets send an empty message for peer connect / disconnect:
This seems not to be the case for NetMQ. The following code blocks on the first s1.ReceiveMultipartBytes()
ZeroMQ has a socket option ZMQ_STREAM_NOTIFY to enable (=1) or disable this behavior. Default is enabled (=1).
As an example, the following Python code uses libzmq and shows the expected behavior:
Output:
Actual behaviour
Steps to reproduce the behaviour
Run above unit test.
The text was updated successfully, but these errors were encountered: