RE: [PHP] Some questions regarding pfsocketopen()
| From: | Gareth Hastings | Date: | Thu, 02 Jan 2003 20:10:58 +0000 |
| Subject: | RE: [PHP] Some questions regarding pfsocketopen() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129983@lists.php.net to get a copy of this message | ||
One last question, do you know how or what method I would use to do this
via a php script? Everything I've tried fails. Like
Makeconnection.php
<?
$mysocket = pfsocketopen('my.server.com', '1234');
?>
--------------
testconenction.php
<?
fputs($mysocket, "VERSION\n");
echo fgets($mysocket, 255);
?>
if I call the makeconnection.php script and then call the testconnection
right after it fails with invalid file resource error.
> -----Original Message-----
> From: Chris Shiflett [mailto:shiflett@php.net]
> Sent: Thursday, January 02, 2003 2:47 PM
> To: Gareth Hastings; 'PHP-List'
> Subject: Re: [PHP] Some questions regarding pfsocketopen()
>
> --- Gareth Hastings <gareth@netgs.co.uk> wrote:
> > Could anyone tell me, is it possible to connect to
> > a persistent socket after it has been opened by a
> > different script?
>
> Sure. Think of it like a persistent database connection in
> Oracle, where the listener is on socket 1521 for everyone.
>
> The persistent part saves you from the 3-way handshake when
> you use the same socket on subsequent page requests. The
> only caveat is that you can only do one thing at a time,
> but this is typically handled for you at a lower level in
> the form of a queue. If I remember correctly, you can
> specify the size of the queue in your function call(s).
>
> Chris
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php