From 83f1433d69297022b498c6bbb098274b9e09a9b6 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Wed, 5 Jul 2023 11:18:12 -0700 Subject: [PATCH 1/2] Allow multicast connections to have address reuse --- ExtLibs/Comms/CommsUDPSerialConnect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ExtLibs/Comms/CommsUDPSerialConnect.cs b/ExtLibs/Comms/CommsUDPSerialConnect.cs index d412640c56..0173fd7bf1 100644 --- a/ExtLibs/Comms/CommsUDPSerialConnect.cs +++ b/ExtLibs/Comms/CommsUDPSerialConnect.cs @@ -92,7 +92,11 @@ public void Open(string host, string port) if (IsInRange("224.0.0.0", "239.255.255.255", hostEndPoint.Address.ToString())) { log.Info($"UdpSerialConnect bind to port {Port}"); - client = new UdpClient(int.Parse(Port), hostEndPoint.AddressFamily); + + client = new UdpClient(); + client.ExclusiveAddressUse = false; + client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); + client.Connect(hostEndPoint.Address, hostEndPoint.Port); IsOpen = true; From fe5cd632f740ea1d073f28ef7b1b11efdac49696 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Wed, 5 Jul 2023 11:33:26 -0700 Subject: [PATCH 2/2] CoT: send string as bytestream instead of string with extra \r which gets converted to bytestream --- Controls/SerialOutputCoT.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controls/SerialOutputCoT.cs b/Controls/SerialOutputCoT.cs index 9fca6428bb..a067bd1eb4 100644 --- a/Controls/SerialOutputCoT.cs +++ b/Controls/SerialOutputCoT.cs @@ -171,7 +171,7 @@ void mainloop() if (CoTStream != null && CoTStream.IsOpen) { - CoTStream.WriteLine(xmlStr.Replace("\r", "")); + CoTStream.Write(xmlStr.Replace("\r", "")); } }); });