You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Eric Cholet <ch...@logilune.com> on 1999/10/02 12:25:26 UTC

Using conn->client->fd

I am writing a chat application. One of it's components waits on data from 
the chat server and sends it to the client (browser). I need to know when 
the client has disconnected. I get the browser's fd from 
r->connection->client->fd, and do a select() waiting for either the browser 
or the chat server to have data available. Even though I'm not reading from 
the browser a hangup will be seen as a zero length packet becoming 
available for reading.

Is it legit to access conn->client->fd ? It seems there ought to be an 
ap_function instead, unless my approach is wrong and there's a better way 
to solve my problem.

--
Eric Cholet



Re: Using conn->client->fd

Posted by "Michael H. Voase" <mv...@midcoast.com.au>.
Gday,

	Use the conn->client->flags value to determine wether the connection
has cloesd. The flag youre looking for is B_EOF. Anyways, just a quick 

	if ( conn->client->flags & B_EOF ) 

	should yeild the test required. There is a wealth of information
in the flag fields that you can use. A couple of handy ones include 
B_RDERR, B_WRERR, B_OUT ( no further output possible ). Consult buff.h
for details...

Cheers Mik.

Eric Cholet wrote:
> 
> I am writing a chat application. One of it's components waits on data from
> the chat server and sends it to the client (browser). I need to know when
> the client has disconnected. I get the browser's fd from
> r->connection->client->fd, and do a select() waiting for either the browser
> or the chat server to have data available. Even though I'm not reading from
> the browser a hangup will be seen as a zero length packet becoming
> available for reading.
> 
> Is it legit to access conn->client->fd ? It seems there ought to be an
> ap_function instead, unless my approach is wrong and there's a better way
> to solve my problem.
> 
> --
> Eric Cholet

-- 
----------------------------------------------------------------------------
 /~\     /~\            CASTLE INDUSTRIES PTY. LTD.
 | |_____| |            Incorporated 1969. in N.S.W., Australia
 |         |            Phone +612 6567 1227 Fax +612 6567 1449
 |   /~\   |            Web http://www.midcoast.com.au/~mvoase
 |   [ ]   |            Michael H. Voase.  Director.
~~~~~~~~~~~~~~          Castle Industries - Industrial Strength
Solutions.
----------------------------------------------------------------------------