AJAX & closing/re-using open connections using XMLHTTPRequest

Posted on 2007-10-12
Medium Priority
Last Modified: 2008-01-09

I use the XMLHTTPRequest & responsetext to simulate a server push for a data grid on my html page.

With only one client browser connected, if i run netstat -a i can see hundreds of connections in a state of "TIME-WAIT" and about 15 connections in state "ESTABLISHED"

The server performance is not affected by these connections never getting closed, but i doubt they're doing any good.

Can they be closed with client side javascript code? Or better still, how do i get XMLHTTPRequest to stop opening a new connection every time and re-use the existing connection?

Question by:jondanger
LVL 11

Accepted Solution

Isisagate earned 2000 total points
ID: 20067798
well you can try creating the variable that handles the request before every call and then setting the variable to "" afterwards..  In all honesty I've never seen the type of behavior you are talking about it should be opening the connection to load the data then closing just like a page load or requesting an image. Make sure something isn't wrong on the backend.

Author Comment

ID: 20079066
hi isisagate,

thanks for the reply, i've run the same code on an XP box and there are no where near the same amount of open ports as on the 2000 box.

As you suggest, there's something wrong on the back end however I'm reluctant to mess with it as i'm not seeing any problems/performance issues. "if it's not broke, don't fix it!"

Any ideas what settings i sould be looking for?

thanks for your time,

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question