Very recently (a few days at most ago) someone was complaining about the
problem you are having.
According to them they can't get the socket function to accept socket
nonblocking.
It would seem that the function is broken, so you can't set nonblocking to a
valid value at the current time.
Hopefully it will be fixed in 4.0.5, due out in a few days.
--
Plutarck
Should be working on something...
...but forgot what it was.
"Joseph Blythe" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey all,
>
> People who have been recieving this list for a while may remember me
> going through all this a while back, so I am not really a newbie when
> using sockets. I am basically trying to rewrite my Online Credit Card
> Verification (OCV) client with the new socket functions.
>
> In thoery the following should work:
>
> --- example1 socket functions ----
>
> $socket = socket(AF_INET, SOCK_STREAM, 0);
> $conn = connect($socket, some_ip_address, some_port);
> set_nonblock($socket);
>
> $packet = "a request";
> write($socket, $packet, some_length);
>
> $start = time();
> $buffer = "";
>
> while ( empty($buffer) && (time() < $start + 30 )) {
> read($socket, $buffer, some_length);
> }
> This does not work will hang until the script times out (max execution
> time is exceeded).
>
> ----- exampe 2 network and file system functions -----
>
> $socket = fsockopen (some_address, some_port, $errno, $errstr, 30);
> set_socket_blocking($socket, 0);
>
> $packet = "a request";
> fputs ($socket, $packet);
>
> $start = time();
>
> while ( empty($buffer) && (time() < $start + 30 )) {
> $buffer = fgets($socket, some_length);
> }
>
> Works! After 30 seconds fgets is timed out.
>
> The lengths I am reading and writing are correct as all request and
> response lengths are pre-determined.
>
> I cannot use set_socket_blocking($socket, 0) in example 1 instead of
> set_nonblock($socket) as it will generate an errora s follows:
>
> Warning: Supplied argument is not a valid File-Handle resource ...
>
> I believe that in example 1 the socket is not being set to nonblock mode?
>
> Can anyone verfiy this, give me a better way, or maybe just put me out
> of my misery :-)
>
> Regards,
>
> Joseph
>
>
>
>
>
>
>
>
> --
> 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 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]