Reconnectable TCP Server Connection

Publish Date: Oct 31, 2012 | 18 Ratings | 1.78 out of 5 | Print | 5 Customer Reviews | Submit your review


One important feature of any server is the ability quickly establish a connection from any client, complete the transaction, and reinitialize to wait for the next connection. This is an example of how to use the TCP Listen VIs to accomplish repeatable connections.

The attached vi creates a listener port on the current system and allows the user to open a TCP connect with this ip address and the specified port. This vi starts off by getting the default IP address for the system if the user doesn't enter in an IP address(w/ .) in the string field. It then creates a TCP listener. As soon as a connection is established it displays the IP addres of the connecting computer and closes the connection. The TCP Listen VI handles the closing of the listener with the next iteration.

The TCP Listen VI incorporates both the Create Listener and Wait On Listener VIs to help users create server applications to open connections and reinitialize them once a connection has been established to wait for the next connection from another client. 

png of attached vi


Back to Top

Customer Reviews
5 Reviews | Submit your review

Please update examples!  - Nov 6, 2007

this example is now officially too old! LV 8.5 refuses to open it "VI version too early to open it". Time to go through and separate the wheat from the chaff! Neville D.

Leave Listener ID open  - Aug 6, 2007

Although this method worked, I had to wait about 5 seconds between reconnects. I found that keeping the listener id open and only closing the connection id allowed me to reconnect without waiting.

Ease up with the style critisisim  - May 25, 2007

As long as you can follow what 's been done code-wise, cut him some slack.

old example, bad style  - Jan 5, 2006

This old example appears in the rss feed! This example has a bad style with all the sequence frames although errorIO is available on all tcp-ip routines. Frame0 is nonsens( can be part of frame 1,frame 1 has two error dialogs which one is first? What is shown here. Frame 2 and 3 can be combined ! Frame 4 can be part of frame 5 ! And the eseence of this process, closing both connections (listener and conection ID) is not hinted at ! Frame 4

Resolved error 60  - May 16, 2003

i had a problem with the TCP listen routines, i was having the error 60 which is common if you try to listen several times in a row on the same port. I solved the problem by lookin at the "TCP-reconnecct example VI" from your site. But i was surprised by the simplicity of the problem. And of the fact that i couldnt find this simple answer anywhere. You only have to Close both the "connection ID" and the "Listen ID", then youl will avoid the error60 code.

View more reviews

Bookmark & Share



TCP Reconnect



Rate this document

Answered Your Question?
Yes No