Re: [PHP] problem while reading on sockets ...

2001-07-27 Thread Arnauld Dravet - smurfie

well because i'm not connecting to a web server ...


- Original Message -
From: "David Robley" <[EMAIL PROTECTED]>
To: "Arnauld Dravet - smurfie" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, July 27, 2001 3:35 AM
Subject: Re: [PHP] problem while reading on sockets ...


> On Thu, 26 Jul 2001 23:43, Arnauld Dravet - smurfie wrote:
> > Hello,
> >
> > simple question:
> >
> > $sock = fsockopen($server_ip, $server_port, $errno, $errstr, 30);
> > while(!feof($sock)) echo fgets($sock,4096);
> > fclose($sock);
> >
> > why does the while() makes an infinite loop, like if FEOF was never
> > found ? what is the character used to tell if there's an EOF or not ?
> > could my problem come from the server i'm connecting to which to not
> > send a "legit" string ?
> >
> > thanks
> >
> > Arnauld Dravet
> > [EMAIL PROTECTED]
>
> Not having done this, but wouldn't you need to send a GET to the server
> to have it return something? At least that seems to be what the example
> in the manual does.
>
> $fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
> if (!$fp) {
> echo "$errstr ($errno)\n";
> } else {
> fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
> while (!feof($fp)) {
> echo fgets ($fp,128);
> }
> fclose ($fp);
> }
>
>
> --
> David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
> CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA
>
>Cause of crash: Inadvertent contact with the ground.
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] problem while reading on sockets ...

2001-07-26 Thread Arnauld Dravet - smurfie

Hello,

simple question:

$sock = fsockopen($server_ip, $server_port, $errno, $errstr, 30);
while(!feof($sock)) echo fgets($sock,4096);
fclose($sock);

why does the while() makes an infinite loop, like if FEOF was never found ?
what is the character used to tell if there's an EOF or not ?
could my problem come from the server i'm connecting to which to not send a "legit" 
string ?

thanks

Arnauld Dravet
[EMAIL PROTECTED]



[PHP] sockets help ...

2001-07-25 Thread Arnauld Dravet - smurfie

Hello,

simple question:

$sock = fsockopen($server_ip, $server_port, $errno, $errstr, 30);
while(!feof($sock)) echo fgets($sock,4096);
fclose($sock);

why does the while() makes an infinite loop, like if FEOF was never found ?

thanks

Arnauld Dravet
[EMAIL PROTECTED]




[PHP] Troubles with while(!feof($socket_id)) and compiling php-4.0.6 ... help please :(

2001-07-25 Thread Arnauld Dravet - smurfie

Hello,

i was using php-4.0.3pl1 until now and never had any problem, except yesterday i had 
to develop a page on which i have to read on a socket ...

problem is that:
while(!feof($socket_id)) {
echo fgets($socket_id, $len);
}

does not work: seems that FEOF is never detected so the PHP enter an infinite loop.

I found many people complaining about that problem on different PHP mailing-list, but 
no real issue ...

So i decided to upgrade PHP, and also apache, and also mysql.

downlaoded php-4.0.6 sources (ieve always used sources)
and when i compile it:

gcc  -I. -I/root/php-4.0.6/ext/standard -I/root/php-4.0.6/main -I/root/php-4.0.6 
-I/root/apache_1.3.20/src/include -I/root/apache_1.3.20/src/os/unix 
-I/root/php-4.0.6/Zend -I/usr/local/mysql/include/mysql 
-I/root/php-4.0.6/ext/xml/expat/xmltok -I/root/php-4.0.6/ext/xml/expat/xmlparse 
-I/root/php-4.0.6/TSRM  -DSUPPORT_UTF8 -DXML_BYTE_ORDER=12 -g -O2  -c microtime.c && 
touch microtime.lo
microtime.c: In function `php_if_getrusage':
microtime.c:99: storage size of `usg' isn't known
microtime.c:102: `RUSAGE_SELF' undeclared (first use in this function)
microtime.c:102: (Each undeclared identifier is reported only once
microtime.c:102: for each function it appears in.)
microtime.c:108: `RUSAGE_CHILDREN' undeclared (first use in this function)
make[3]: *** [microtime.lo] Error 1
make[3]: Leaving directory `/root/php-4.0.6/ext/standard'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/php-4.0.6/ext/standard'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/php-4.0.6/ext'
make: *** [all-recursive] Error 1
mushroom:~/php-4.0.6#

any help would be really appreciated ... :)

thanks 
Arnauld Dravet
[EMAIL PROTECTED]