Howcan I keep a special TCP connection for a long time?

Unanswered Question
Jun 4th, 2003
User Badges:

I must make a special TCP connection(like ftp, telnet ect.) between two equipment for a long time, for example, you can see follow information when you open you mail with netstat command:


Active Connections

Proto Local Address Foreign Address State


and, after you quit your mail box, you can see the information:


Active Connections

Proto Local Address Foreign Address State

TCP aaron:1147 TIME_WAIT

then, after about 30 seconds, you'll lost the record.

I must keep the connection for all the time due to special application even there no data need to across, how can I do?


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
wkumari Wed, 06/04/2003 - 05:07
User Badges:
  • Bronze, 100 points or more

Ummm, you will need to provide more information as to why you are trying to do this, but the short answer is goning to be that it depends on the application. Some applications (Telnet, SSH, FTP, etc) keep the connection open for a long time, some applications (HTTP, etc) keep the connection open for a much shorter time. With well behaved applications on a well behaved network you shouldn't be seeing things stuck in TIME_WAIT for very long.

Post some details on why you want this info, there is probably a better way of accomplishing what you want. It kinda sounds like you are wanting to do this for logging / monitoring, in which case something like Netflow or *shudder* IP accounting might work better.

rjackson Wed, 06/04/2003 - 05:50
User Badges:
  • Bronze, 100 points or more

Unless there is something special going on like IPSEC or dynamic access-lists the network infrastructure has nothing to do with this, it is the application that opens and closes connections. You open the mail box and it opens a connection to the server. You close the mailbox and it closes the connection THAT IT OPENED. If you want to keep the connection open you have to keep the application running. Some apps will timeout after idling too long like telnet. In those cases you have to change the applications timeout if possible. Other apps have an option for persistant connections. That means they hold the connection open instead of closing and reopening with each transaction.

rais Wed, 06/04/2003 - 06:27
User Badges:
  • Silver, 250 points or more

Intermediate devices, like Firewalls, also keep track of connection's lifetime and may disconnect you after some configed idle time, even if applications don't terminate the socket.


davidliji Wed, 06/04/2003 - 17:28
User Badges:

Everybody, thanks for your help, it very helpful to me.

I mean that whether there is a INDUSTRY STANDARD holding time between the TCP connection when the data transfers is completed, which factors controlled the holding time? by the TCP/IP industry standard? by the applications absolutely? or by application and TCP/IP protocol and computer all together?

Note, not noly well-konw ports, it also all other port.

Thanks again.

thisisshanky Wed, 06/04/2003 - 06:39
User Badges:
  • Purple, 4500 points or more

You should be tweaking Windows registry keys inorder to achieve what you are looking for.

First of all back up your registry files, and then use regedit.exe to tweak your registry settings.

For Windows 98, ME and 95, the key is at,



And for Win 2000, Nt4.0 and XP the key is at,



If you dont see these keys in there, you need to create one.

The type of data is DWORD. Set this value to something like 10.

Also one more thing to notice is that, its not just a problem with your PC, doing the timeout. If the session is going through a firewall or nat kind of device, and if connection is idle, the device drops the translation slot and your session drops.

Check your power management settings. If you are doing telnet from a laptop and the laptop is running on backup power, everytime you go idle on the machine, within a minute the laptop will shut down the display and possibly the lan cards which causes your telnet or ftp connection to drop. So turn off any power savings options on your PC or laptop.

Check out the above options, and see if you are able to rectify the problem.



This Discussion