开发者

Debugging socket_select() PHP

开发者 https://www.devze.com 2023-01-15 18:51 出处:网络
So I\'m writing a chat with a php socket server. CODE: http://pastebin.com/v5XKkfyy If i try to debug by

So I'm writing a chat with a php socket server.

CODE:

http://pastebin.com/v5XKkfyy

If i try to debug by

print_r($read);

just before line 75 i get this output

Array
(
    [2] => Resource id #6
    [0] => Resource id #4
)

PHP Warning:  socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php     on line 75

Warning: socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php on     line 75
PHP Warning:  socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php     on line 75

Warning: socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php on     line 75
Array
(
    [0] => Resource id #4
)

This is happening just as i call line 424.

Someone on freenode #php said i mite be passing an integer instead of a so开发者_开发技巧cket resource. I find that hard to belive.

Hope one of you can help me.


We found the answer on freenode.

To fix this i had to comment out line 427: socket_close($client[$i]['sock']);

Thanks everybody!

0

精彩评论

暂无评论...
验证码 换一张
取 消