I spoke too soon,
The problem is back so the compiling with dot net 3.5 wasn't the problem.
The WSE7 system i am using the DLL in has 4 NIC's fitted and having looked on the net this can cause problems, i have pasted the code below that sets up the socket:
I read on the net the following:
_rxEndpoint = New IPEndPoint(_NICIPaddress, _MulticastPort)
_rx.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, True)
_rx.ExclusiveAddressUse = False
_rx.Client.ReceiveTimeout = 15000
_rx.Ttl = _tTl
LastGoodImageSave = DateTime.Now
LastImageSave = DateTime.Now
Timer_SaveImageCheck.Interval = 1000
Timer_SaveImageCheck.Enabled = True
_isCapturing = True
from: How do I re-open the Visual Studio Immediate Window? - Stack Overflow
so as you see from the code above i set the IPEndPoint to the NIC Address (_NICIPaddress), in my case the NIC IP address is 172.16.0.25, rather than IPAddress.Any
Mike G Reply:
I had the same issue on a windows failover cluster... Multiple nics....
I ended up opening a case with Micorsoft as I thought it was an OS issue.
You need to specify the IP of the interface you whant to use to create a IPEndpoint. THen use that endpoint when creating the socket instead of IPAddress.any
That solved the problem for me.
Hope it helps even if it is late.
Mike G is correct. One of the constructors for the UDPClient class takes an IPEndPoint as an argument. If the IPEndPoint is set to the IP address of a local interface, then that is the interface that the UDPClient and underlying socket will use so yes, you can have two UDP clients bound to the same port on a a machine as long as they are on seperate local IP interfaces (i.e. multi-homed or multi-NIC).
The network cards IP addresses are set as below:
|Cable Ident ||Network Connection ||IP Address |
|1 ||To Switch 1 ||172.16.0.25 |
|2 ||To Switch 2 ||192.168.2.19 |
|4 ||Data Download ||192.168.0.4 |
|3 ||Expansion ||192.168.1.4 |
The PC sending the UDP Data has an IP of 172.16.0.42 and this is connected via network Switch 1 to the NIC with IP 172.16.0.25.
Hopefully what i have done makes sense, if i have missed any infor that would be useful let me know.
Finally i found on the WSE7 system if i disconnect the network cables from all other NIC then the app starts recieving the packets ok, and then if i plug the network cables back in the app keeps receiveing the packets, until i restart the system.
My questions are as follows:
Has anyone else experienced something like this?
Does anyone know a way to get it working?
And have i implemented it correctly?
Thanks for any advice/help.