FomTarro/VTS-Sharp

Discovery port detection in VTSWebSocket not configured for shared port ownership

xserp opened this issue · 0 comments

xserp commented

In VTSWebSocket in the function StartUDP() at line 70, the udp client is being initialized with:

UDP_CLIENT = new UdpClient(47779);

Like this it will take full ownership of the port. To allow sharing of the port it must instead be created with something like:

IPEndPoint LOCAL_PT = new IPEndPoint(IPAddress.Any, 47779);
UDP_CLIENT = new UdpClient();
UDP_CLIENT.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
UDP_CLIENT.Client.Bind(LOCAL_PT);

this sets the socket options to allow reuse