Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Does IsClientConnected Work? 1

Status
Not open for further replies.

tlhawkins

Programmer
Dec 28, 2000
797
US
Hey,

does anyone know how the Response.IsClientConnected call works? I actually need to port the same functionality to PHP which obviously has no such call.

I've been thinking about it and it seems like one of two things must be happening in order to be even slightly acurate.

One, there would have to be some kind of message sent from the server to the browser that would fail because it's not connected.

Or, Two, the browser would have to send some kind of message to the server when it closes the page.

Either way, there has to be some kind of communication, or at least attempted communication between the browser and the server.

Anyone have any more light to shed on the process?

Travis Hawkins
 
Don't know about isClientConnected, as I have never used it, but I did a quick google search and found this - may be of some help to you (they have a simulation of the method in PHP)


ASP Objects Simulated in PHP 1.0

Good Luck!




TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
did you find the call in the link I provided, or elsewhere?

Could you post your solution so others can benefit as well?

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
yeah, it was at that link you posted. They just wrapped this PHP call to look like the ASP Response.IsClientConnected

Code:
<?php
  if (connection_aborted()) {
    break; // or whatever
  }
?>

I didn't post the PHP call before as it isn't that helpful on an ASP forum, but maybe someone will stumble across it from a search.

I'm still very curious about how IsClientConnected (and by extension connection_aborted() ) works. If anyone has insight into that please let me know. I know how to USE that call, but I'm curious about the guts, what is happening for it to know if the browser is still connected.

Travis Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top