Why Do I Receive Error 60 from Create Listener for 60 Seconds?

Updated Jan 22, 2018

Reported In

Software

  • LabVIEW Full

Issue Details

I have a program which creates a listener at a TCP port. If the connection closes, I create a new listener. Even though the original listener ID was passed to TCP Close before opening a new listener, the VI returns Error 60 (The specified network address is currently in use) for several seconds.

Solution

Create one listener per each port the program needs to listen to, as opposed to one listener per connection. See Figure 1 below for the proper implementation. Connections may close and open, but the listener should remain the same as long as it will be re-used. Placing the Create Listener function outside of the loop will correct the problem.

Figure 1. Proper TCP Create Listener VI implementation.

Additional Information

The TCP Listen VI, available on the Data Communication»Protocols»TCP palette detects if a listener already exists for a given port, and automatically reuses existing listeners. 

Different OS platforms respond differently to port configurations such as SO_REUSEADDR, and so this problem may appear on some operating systems but not others. The correct use of Create Listener will avoid any extraneous wait time.