RE: [PHP] Some questions regarding pfsocketopen()
| From: | Gareth Hastings | Date: | Thu, 02 Jan 2003 21:39:09 +0000 |
| Subject: | RE: [PHP] Some questions regarding pfsocketopen() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129995@lists.php.net to get a copy of this message | ||
I just tried something similar,
<?
session_start();
session_register("mysocket");
echo "<pre>\n";
if ($p == "1")
{
$mysocket = pfsockopen("172.24.200.2", "1372");
echo fgets($mysocket, 255);
echo "<a href='con.php?p=2'>Send Data</a>\n";
}
else
{
echo (isset($mysocket) ? "It's set\n" : "Not set\n");
echo $mysocket;
fputs($mysocket, "cntmpusr;tmppass\n");
//while (!feof($mysocket))
//{
// echo fgets($mysocket, sizeof($mysocket));
//}
//fclose($mysocket);
}
echo "</pre>\n";
?>
this is the output I get once I've set the socket and tried to send data
down it.
-------------------------------------
It's set
0
Warning: fputs(): supplied argument is not a valid File-Handle resource
in con.php on line 17
-------------------------------------
So I guess you can't pass sockets like that :/
> -----Original Message-----
> From: Michael J. Pawlowsky [mailto:mikejp@videotron.ca]
> Sent: Thursday, January 02, 2003 4:32 PM
> To: Gareth Hastings
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] Some questions regarding pfsocketopen()
>
>
> Well I didnt try to write or read to it...
>
> But this works.... But all that's telling me is that the var is
there..
> not if it's still open.. will leave that to you to find out... Let us
> know....
>
>
>
>
> --------------file s1.php ---------------------------
>
> <?php
> session_start();
> $sid = session_id();
>
> $mysocket = pfsockopen("localhost", "80");
>
> session_register("mysocket");
>
> echo "<a href=\"s2.php?PHPSESSID=$sid\">Next</a>";
>
>
> ?>
>
>
> -------------------- file s2.php ---------------------------------
>
> <?php
>
> session_start();
>
> echo (isset($_SESSION['mysocket']) ? "Socket found and open" :
> "Socket not found");
>
>
>
> ?>