zeromq/netmq

System.Net.Sockets.SocketException on Mono 4.6.1

Closed this issue · 1 comments

Environment

NetMQ Version:     3.3.3.4
Operating System:  Ubuntu Linux 16.04 LTS x86 (32bit)
.NET Version:      Mono 4.6.1 (Stable 4.6.1.5/ef43c15 Wed Oct 12 09:29:26 UTC 2016)

Expected behaviour

Creating a socket, like the one below, should not throw an exception:
var publisher = new PublisherSocket("@tcp://127.0.0.1:9500");

Actual behaviour

Trying to create a new PublisherSocket on mono will throw an exception for using the ReuseAddress option:

System.Net.Sockets.SocketException (0x80004005): Operating system sockets do not support ReuseAddress.
If your socket is not intended to bind to the same address and port multiple times remove this option, otherwise you should ignore this exception inside a try catch and check that ReuseAddress is true before binding to the same address and port multiple times.
  at System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Int32 optionValue) [0x0003d] in <59be416de143456b88b9988284f43350>:0
  at System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Boolean optionValue) [0x0000e] in <59be416de143456b88b9988284f43350>:0
  at NetMQ.Core.Utils.Signaler..ctor () [0x0002e] in <3a2aeb94302c42a9990a4beacef5db1a>:0
  at NetMQ.Core.Mailbox..ctor (System.String name) [0x00012] in <3a2aeb94302c42a9990a4beacef5db1a>:0
  at NetMQ.Core.Ctx..ctor () [0x00035] in <3a2aeb94302c42a9990a4beacef5db1a>:0
  at NetMQ.NetMQConfig.get_Context () [0x00017] in <3a2aeb94302c42a9990a4beacef5db1a>:0
  at NetMQ.NetMQSocket..ctor (NetMQ.ZmqSocketType socketType, System.String connectionString, NetMQ.NetMQSocket+DefaultAction defaultAction) [0x00006] in <3a2aeb94302c42a9990a4beacef5db1a>:0
  at NetMQ.Sockets.PublisherSocket..ctor (System.String connectionString) [0x00000] in <3a2aeb94302c42a9990a4beacef5db1a>:0

Steps to reproduce the behaviour

Create a simple console program:

private static int Main(string[] args)
{
    var socket = new PublisherSocket("@tcp://127.0.0.1:9500");
}

This is related to #592

I can confirm this working on Mono 4.4.* and on .NET under Windows, but throwing on mono 4.6+

This should be fixed in mono 4.8. I think we may close this issue.