You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/07/14 16:07:48 UTC

Re: Socket-based porotocol module: how to re-use connection?

Jie Gao wrote:
> Hi All,
> 
> I am playing with a socket-based protocol module based on Stas'
> MyApache::EchoSocket.
> 
> I wonder what is needed to enable the function of re-using connections?

As long as you don't quit the handler you keep the connection open.

However I still have to investigate what are the issues with socket based 
protocol modules, there was a thread on the httpd-dev list saying that there 
some problems with it. So it's better to use bucket brigade based data 
manipulations.

> In perl we can use this:
> 
> $server = IO::Socket::INET->new(LocalHost => "my.host.com",
>                                 LocalPort => 8899,
>                                 ReuseAddr => 1,
>                                 Proto     => "tcp",
>                                 Listen    => 200 )
> 
> How is this implemented http in mod_perl via Apache2 without using http?
> 
> Any suggestions?

it's not implemented in mod_perl, but in Apache 2 itself. You can look at the 
C source code and write similar in perl inside your handler. Most of the 
relevant logic resides in files starting with http_ in the apache source.



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com