我网上找了个demo 运行了下 报N个错  http://blog.51yip.com/php/673.html/comment-page-1 
为什么会错了呢?
http://127.0.0.1/fe/client.php /*运行客户端报的错误*/
( ! ) Warning: socket_connect(): in E:\wamp\www\fe\client.php on line 4 
Call Stack 
# Time Memory Function Location 
1 0.0004 248992 {main}( ) ..\client.php:0 
2 0.0004 250056 socket_connect ( ) ..\client.php:4 
/*运行服务端报的错误*/http://127.0.0.1/fe/server.php
各种 函数报错 一大堆  N个吧 不贴出来了 机子都卡主了

解决方案 »

  1.   

    先运行 http://127.0.0.1/fe/server.php
    后运行 http://127.0.0.1/fe/client.php他那个代码虽然不报错,但也不能正常工作
      

  2.   

    http://127.0.0.1/fe/server.php 这个我打不开哈( ! ) Fatal error: Maximum execution time of 30 seconds exceeded in E:\wamp\www\fe\server.php on line 12 
    Call Stack 
    # Time Memory Function Location 
    1 0.0125 250240 {main}( ) ..\server.php:0 
      

  3.   


    ( ! ) Fatal error: Maximum execution time of 30 seconds exceeded in E:\wamp\www\fe\server.php on line 12 
    Call Stack 
    # Time Memory Function Location 
    1 0.0125 250240 {main}( ) ..\server.php:0 
      

  4.   

    我打开 http://127.0.0.1/fe/server.php 就报错
      

  5.   

    那是超时了,你需要在 http://127.0.0.1/fe/server.php 后的 30 秒之内 http://127.0.0.1/fe/client.php
      

  6.   


    不对 还是有问题 是不是端口问题。。 还是我网速问题。。为什么在客户端上也看不到 东西 服务端也看不到东西 // 将客户的信息写到通道中,传给服务器端   
            if (!socket_write($socket, "SOME DATA\n")) {   
               echo "Write failed\n";   
           }  这个不是 客户端发送信息给服务端  服务端接收信息 应该 // 从客户端取得信息   
                while ($data = @socket_read($connection, 1024, PHP_NORMAL_READ)) {   
                        printf("Buffer: " . $data . "\n");   
                       //取得信息给客户端一个反馈   
                       socket_write($connection, "Information Received\n");