Re: PHP sockets/daemon problem

From: Date: Wed, 26 Jun 2002 21:53:12 +0000
Subject: Re: PHP sockets/daemon problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-104067@lists.php.net to get a copy of this message
Thanks! Those were a huge help...turns out the problem was with the daemon and not my code. --Josh Levine B I G D O G wrote: > > Some great articles for sockets...might help out... > > http://www.phpbeginner.com/columns/demitrious/sockets > > http://www.phpbeginner.com/columns/demitrious/sockets-connection > > B i g D o g > > ----- Original Message ----- > From: "Josh Levine" <joshl-php@levindustries.com> > To: <php-general@lists.php.net> > Sent: Wednesday, June 26, 2002 11:32 AM > Subject: [PHP] PHP sockets/daemon problem > > > I'm trying to write a simple PHP script that communicates with a daemon > > running on the same server. > > > > Basically, the daemon just accepts an integer and returns an integer: > > > > [josh@jlevine-research josh]$ telnet 127.0.0.1 60324 > > Trying 127.0.0.1... > > Connected to localhost. > > Escape character is '^]'. > > 9 > > 25Connection closed by foreign host. > > > > When I try doing this with PHP, however, the output is 2[]5 (where [] == > > a small square symbol). > > > > Here is the script: > > > > <?php > > $fp = fsockopen("127.0.0.1", 60324, $errno, $errstr); > > if (!$fp) { > > echo "ERROR: $errno - $errstr<br>\n"; > > } else { > > socket_set_blocking ($fp, 1); > > socket_set_timeout($fp, 200); > > fwrite($fp,"9\n"); > > $return = fread($fp,4); > > echo $return; > > fclose($fp); > > } > > ?> > > > > I've tried various string format and type-casting functions with no > > results (usually just returns nothing after formatted). > > > > Any ideas? > > > > Thanks in advance, > > Josh Levine > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#104067) next »