n00bzor Posted April 30, 2009 Report Share Posted April 30, 2009 Hi, my problem is this. The vi tcp open connection keep opening connections on all the ports, incrementing the port with every run of the loop it's in, until it runs out of ports and claims that the "network adress is currently in use". I've used this vi, and it's "family" for some time, in the same configuration, and this problem never occured before. Any suggestions would be greatly apreciated. Quote Link to comment
TobyD Posted April 30, 2009 Report Share Posted April 30, 2009 QUOTE (n00bzor @ Apr 29 2009, 02:04 PM) Hi, my problem is this. The vi tcp open connection keep opening connections on all the ports, incrementing the port with every run of the loop it's in, until it runs out of ports and claims that the "network adress is currently in use". I've used this vi, and it's "family" for some time, in the same configuration, and this problem never occured before. Any suggestions would be greatly apreciated. Can you post the code so we can see how you are calling TCP Open Connection.vi Quote Link to comment
Mark Smith Posted April 30, 2009 Report Share Posted April 30, 2009 QUOTE (n00bzor @ Apr 29 2009, 03:04 PM) Hi, my problem is this. The vi tcp open connection keep opening connections on all the ports, incrementing the port with every run of the loop it's in, until it runs out of ports and claims that the "network adress is currently in use". I've used this vi, and it's "family" for some time, in the same configuration, and this problem never occured before. Any suggestions would be greatly apreciated. If you're running out of ports (I'm assuming the "local port" control is unwired), then it most likely means none of your connections are getting closed properly or you're really running out of local ports. A TCP connection that reads from a port won't release its port immediately upon a close - it goes into FIN_WAIT and TIME_WAIT states to allow for packets wandering around the net and such to arrive. Opening a connection for write only allows it to release upon close (or as soon as all data is sent). http://www.developerweb.net/forum/showthread.php?t=2941 So, if you're looping thru connections at fast rate, then you might actually run out before the ports before they exit the WAIT states and become available again. With that said, I can't imagine how one would run out of local ports in any kind of system - you should have at least hundreds available. Assuming you're on a windows machine, run netstat from the command window and see what ports are in use when you get this error. Mark Quote Link to comment
santi122 Posted May 1, 2009 Report Share Posted May 1, 2009 Hi n00bzor, what about trying it like this way ?? greetz chris Quote Link to comment
Rolf Kalbermatter Posted May 5, 2009 Report Share Posted May 5, 2009 QUOTE (santi122 @ Apr 30 2009, 01:28 AM) Hi n00bzor,what about trying it like this way ?? You can even keep the error wire wired to the TCP Close function. All Close functions in LabVIEW "should" (and usually do) close the refnum they are given, independant of the error in. There were a few LabVIEW versions in the past where one or the other did have a bug and did not properly do so but that was usually fixed very quickly. Rolf Kalbermatter Quote Link to comment
n00bzor Posted May 6, 2009 Author Report Share Posted May 6, 2009 QUOTE (santi122 @ Apr 30 2009, 09:28 AM) Hi n00bzor,what about trying it like this way ?? greetz chris Hey, sorry for the late response. Tried it your way, it's still not working. Here's how i'm doing it : Problem is that for about 3 months i worked with it this way, opening around 10 connections on 10 ports, on the same host and did not encounter this problem. Only thing i can think about now is that installing SP3 for Win XP totally ruined SOMETHING. Don't really know what. QUOTE (mesmith @ Apr 30 2009, 01:12 AM) If you're running out of ports (I'm assuming the "local port" control is unwired), then it most likely means none of your connections are getting closed properly or you're really running out of local ports. A TCP connection that reads from a port won't release its port immediately upon a close - it goes into FIN_WAIT and TIME_WAIT states to allow for packets wandering around the net and such to arrive. Opening a connection for write only allows it to release upon close (or as soon as all data is sent). So, if you're looping thru connections at fast rate, then you might actually run out before the ports before they exit the WAIT states and become available again. With that said, I can't imagine how one would run out of local ports in any kind of system - you should have at least hundreds available. Assuming you're on a windows machine, run netstat from the command window and see what ports are in use when you get this error. Mark Hi, Well, you're totally right on that one. Ports do remain in TIME_WAIT and CLOSE for about two minutes, and i think that might really be the problem. I do have thousands of ports available, however, it runs through in a matter of seconds. Using the local port parameter only results in the program running once then shutting down due to the "address in use" errorr. Like i said before, using this configuration worked perfectly before. Any ideas on how i can get windows xp to close inactive, or better yet, ports in time_wait faster? Quote Link to comment
n00bzor Posted May 6, 2009 Author Report Share Posted May 6, 2009 I managed to fix it. I was opening a data connection on a obviously different port for every data session instead of using only one session. Thanks a lot for the help guys. Have a good one. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.