09-29-2008 09:17 AM
If you use the "TCP Listen.vi" and try to listen on the same port on more than one network interface, you can get strange results.
In "TCP Listen.vi" you can specify the network interface and the port to be used, "TCP Listen.vi" then uses the "Internecine Avoider.vi" to reuse listener reference for a specific port. The problem is that the "Internecine Avoider.vi" does not take the network interface into account when searching for used ports, thus returning the first occurrence of the specified port, even if that is on another network interface than specified.
To reproduce (on a multi NIC system)
Create a listener on port X on NIC-A, this results in Listener ID = ID-A.
Create another listener on port X on NIC-B simultaneously, you'll get back Listener ID = ID-A again, where I would expect Listener ID = ID-B!
10-07-2008 04:12 AM
Hi Melroth,
I don't know if this is still an issue for you - the lack of response leads me to think there's no traditional work-around - so I built one! (See attached.)
It implements the same logic as the standard VIs, though, instead of tracking only port#, it tracks a key made from IP-address and port, so connections on different addresses will be handled correctly.![]()
It's very simple, it's also untested!![]()
Cheers!