diff --git a/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs b/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs index 86c588b..bccff3a 100644 --- a/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs +++ b/TimberWinR.ServiceHost/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.20.0")] -[assembly: AssemblyFileVersion("1.3.20.0")] +[assembly: AssemblyVersion("1.3.21.0")] +[assembly: AssemblyFileVersion("1.3.21.0")] diff --git a/TimberWinR/Inputs/UdpInputListener.cs b/TimberWinR/Inputs/UdpInputListener.cs index d7f0cd7..728e387 100644 --- a/TimberWinR/Inputs/UdpInputListener.cs +++ b/TimberWinR/Inputs/UdpInputListener.cs @@ -13,8 +13,8 @@ namespace TimberWinR.Inputs { public class UdpInputListener : InputListener { - private UdpClient _udpListenerV6; - private readonly Thread _listenThreadV6; + private UdpClient _udpListenerV4; + private readonly Thread _listenThreadV4; private readonly int _port; private long _receivedMessages; @@ -36,13 +36,11 @@ namespace TimberWinR.Inputs public UdpInputListener(CancellationToken cancelToken, int port = 5140) : base(cancelToken, "Win32-Udp") { - _port = port; - - + _port = port; _receivedMessages = 0; - _listenThreadV6 = new Thread(StartListener); - _listenThreadV6.Start(); + _listenThreadV4 = new Thread(StartListener); + _listenThreadV4.Start(); } @@ -51,31 +49,21 @@ namespace TimberWinR.Inputs LogManager.GetCurrentClassLogger().Info("Shutting Down {0}", InputType); // close UDP listeners, which will end the listener threads - _udpListenerV6.Close(); + _udpListenerV4.Close(); // wait for completion of the threads - _listenThreadV6.Join(); + _listenThreadV4.Join(); base.Shutdown(); } private void StartListener() { - var groupV6 = new IPEndPoint(IPAddress.IPv6Any, _port); - // Create the socket as IPv6 - var dualModeSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp); - - // - // Now, disable the IPV6only flag to make it compatable with both ipv4 and ipv6 - // See: http://blogs.msdn.com/b/malarch/archive/2005/11/18/494769.aspx - // - dualModeSocket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, 0); - dualModeSocket.Bind(groupV6); + var groupV4 = new IPEndPoint(IPAddress.Any, _port); - _udpListenerV6 = new UdpClient(); - _udpListenerV6.Client = dualModeSocket; - - LogManager.GetCurrentClassLogger().Info("Udp Input on Port {0} Ready", groupV6); + _udpListenerV4 = new UdpClient(_port); + + LogManager.GetCurrentClassLogger().Info("Udp Input on Port {0} Ready", groupV4); string lastMessage = ""; try @@ -84,13 +72,18 @@ namespace TimberWinR.Inputs { try { - byte[] bytes = _udpListenerV6.Receive(ref groupV6); + byte[] bytes = _udpListenerV4.Receive(ref groupV4); var data = Encoding.UTF8.GetString(bytes, 0, bytes.Length); lastMessage = data; var json = JObject.Parse(data); ProcessJson(json); Interlocked.Increment(ref _receivedMessages); } + catch(ArgumentException aex) + { + LogManager.GetCurrentClassLogger().Error(aex); + break; + } catch(SocketException) { break; @@ -107,7 +100,7 @@ namespace TimberWinR.Inputs Interlocked.Increment(ref _parsedErrors); } } - _udpListenerV6.Close(); + _udpListenerV4.Close(); } catch (Exception ex) { diff --git a/TimberWinR/ReleaseNotes.md b/TimberWinR/ReleaseNotes.md index dc95680..5f7e720 100644 --- a/TimberWinR/ReleaseNotes.md +++ b/TimberWinR/ReleaseNotes.md @@ -3,6 +3,9 @@ TimberWinR Release Notes A Native Windows to Redis/Elasticsearch Logstash Agent which runs as a service. Version / Date +### 1.3.21.0 - 04/13/2015 +1. Rolled Udp listener support to V4 only, too many issues with dual mode sockets + and hosts file. If we want to add this back, I will add a Udpv6 input. ### 1.3.20.0 - 2015-04-03