AJAX & closing/re-using open connections using XMLHTTPRequest

Posted on 2007-10-12
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

    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

    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,

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction (All good things must come to an end ( The original MySQL API ( has gone away, deprecated by PHP in Version 5.5, and removed from PHP in all curre…
    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery… 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.

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now