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:
[COLOR=#a31515][/COLOR]
_rxEndpoint = [COLOR=blue]New[/COLOR] [COLOR=#2b91af]IPEndPoint[/COLOR](_NICIPaddress, _MulticastPort)
_rx.Client.SetSocketOption([COLOR=#2b91af]SocketOptionLevel[/COLOR].Socket, [COLOR=#2b91af]SocketOptionName[/COLOR].ReuseAddress, [COLOR=blue]True[/COLOR])
_rx.ExclusiveAddressUse = [COLOR=blue]False[/COLOR]
_rx.Client.ReceiveTimeout = 15000
_rx.Ttl = _tTl
_rx.Client.Bind(_rxEndpoint)
_rx.JoinMulticastGroup(_MulticastIP)
ListenThread.Start()
LastGoodImageSave = [COLOR=#2b91af]DateTime[/COLOR].Now
LastImageSave = [COLOR=#2b91af]DateTime[/COLOR].Now
Timer_SaveImageCheck.Interval = 1000
Timer_SaveImageCheck.Enabled = [COLOR=blue]True[/COLOR]
_isCapturing = [COLOR=blue]True[/COLOR]
I read on the net the following:
from:
How do I re-open the Visual Studio Immediate Window? - Stack Overflow
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.
It wasn't.
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.
Dave's Reply:
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).
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
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.
Stu