为什么send的消息在close的时候才会收到?

用php做Server端:

public function onConnect(swoole_server $serv, $fd, $from_id, $data) {

        //有client连接的时候更新server信息
        $this->updateServerStats();

        $serv->send($fd, "hello");

        echo 'onConnect\n';
    }

android 客户端:

 client = new Socket(Config.Service.Push.PUSH_HOST, Config.Service.Push.PUSH_PORT);
                            BufferedReader in;
                            while(client != null && client.isConnected()) {
                                in = new BufferedReader(new InputStreamReader(client.getInputStream()));
                                String content = "";
                                String line = "";
                                while ((line = in.readLine()) != null) {
                                    content += line;
                                }

                                if(!content.equals("")) {
                                    Log.d("msg:" + content);
                                }
                            }

但是连接后并没有输出信息,为何当我关掉server的时候,才会打印?

2015-01-08 20:54
0

要回复问题请先登录注册