Is there a way to change the UdpClient IP address on the fly?
StartUpd()
throws a
System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
even after doing a StopUpd()
.
private static UdpClient udpClientR;
void StartUpd()
{
try
{
udpClientR = new UdpClient();
udpClientR.Connect(Settings.rxIPAddress, PORT_RX_LOCAL);
var t1 = new Thread(() => UdpReceiveThread(PORT_RX_REMOTE))
{ IsBackground = true };
t1.Start();
...
private void StopUpd()
{
try
{
udpClientR.Close();
...