Jump to content

Pannekoek

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Pannekoek's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Aaarg I'm such a fool. I had the assumption that readability indicated that the connection was established for a while. But it has been on the MSDN site all along. Well, at least I know now. Thanks!
  2. as requinix said. -- One would expect stream_select () to return immediately with the socket in $r to indicate that the connection has been established. Anyhow, I fixed it to also check for writability on the stream. Then it returns immediately.
  3. stream select should modify the given arrays by reference indicating that a certain event would not block; in this case, readability would mean that the connection has been established. For reference: see http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141%28v=vs.85%29.aspx Implementation for this function is the same on linux systems etc. --
  4. Hello lads, I'm hoping someone here can say me why the following piece of code is not working as expected: <?php // Create stream $sock = stream_socket_client ('tcp://www.google.nl:80', $i_Errno, $s_Errstr, null, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); sleep (1); $r = $w = $e = array (); $r [] = $sock; echo 'selecting..' . PHP_EOL; $i_Changed = stream_select ($r, $w, $e, null); print_r ($i_Changed); I would expect stream_select () to return immediately with $r containing one element (the stream resource). Especially since the scripts halts one second. That should be more than enough to complete the connection attempt. And indeed, the stream is connected since fread and fwrite will succeed. However, stream_select does not agree with me. How come?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.