zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.95k stars 744 forks source link

NetMQBeacon Configure on localhost 127.0.0.1 address throws exception #986

Open d79ima opened 3 years ago

d79ima commented 3 years ago

Environment

NetMQ Version:    4.0.1.6
Operating System: windows 10 x64
.NET Version:   .net core 3.1  

Expected behaviour

I would like to be able to configure NetMQBeacon to publish and receive messages on the localhost ip address which is very convenient.

Actual behaviour

When i try this i get the following exception **System.ArgumentNullException HResult=0x80004003 Message=Value cannot be null. (Parameter 'remoteEP') Source=System.Net.Sockets StackTrace: at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint remoteEP) at NetMQ.NetMQBeacon.Shim.SendUdpFrame(NetMQFrame frame) at NetMQ.NetMQBeacon.Shim.OnPipeReady(Object sender, NetMQSocketEventArgs e) at NetMQ.NetMQSocket.InvokeEvents(Object sender, PollEvents events) at NetMQ.NetMQPoller.RunPoller() at NetMQ.NetMQPoller.Run(SynchronizationContext syncContext) at NetMQ.NetMQPoller.Run() at NetMQ.NetMQBeacon.Shim.Run(PairSocket shim) at NetMQ.NetMQActor.RunShim() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.ThreadHelper.ThreadStart()

This exception was originally thrown at this call stack: System.Net.Sockets.Socket.SendTo(byte[], int, int, System.Net.Sockets.SocketFlags, System.Net.EndPoint) NetMQ.NetMQBeacon.Shim.SendUdpFrame(NetMQ.NetMQFrame) NetMQ.NetMQBeacon.Shim.OnPipeReady(object, NetMQ.NetMQSocketEventArgs) NetMQ.NetMQSocket.InvokeEvents(object, NetMQ.PollEvents) NetMQ.NetMQPoller.RunPoller() NetMQ.NetMQPoller.Run(System.Threading.SynchronizationContext) NetMQ.NetMQPoller.Run() NetMQ.NetMQBeacon.Shim.Run(NetMQ.Sockets.PairSocket) NetMQ.NetMQActor.RunShim() System.Threading.ThreadHelper.ThreadStart_Context(object)** ... [Call Stack Truncated]`

Steps to reproduce the behaviour

var beacon = new NetMQBeacon(); beacon.Configure(BeaconPort, "127.0.0.1"); beacon.Publish("some msg", TimeSpan.FromSeconds(5)); ... exception is thrown on a NetMQ background thread.