LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CreateTCPListener Bug

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!

 

0 Kudos
Message 1 of 2
(2,731 Views)

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.Smiley Wink

 

It's very simple, it's also untested!Smiley Surprised

 

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 2
(2,686 Views)