BufferedReader卡在读取上。不会从Socket读取

时间:2017-01-24 11:39:47

标签: java android sockets tcp-ip

这里

try
{
    System.out.println("testIN");
    Socket socket = new Socket("10.0.0.16", 8090);
    while (socket.isConnected())
    {
        PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true);
        printWriter.println("[05]");
        printWriter.println("\n");
        System.out.println(printWriter.checkError());
        Thread.sleep(5000);
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        if(bufferedReader.ready())
            System.out.println("READ: "+bufferedReader.read());
        else
            System.out.println("error");
        bufferedReader.close();
        socket.close();
        break;
    }
} catch(Exception e) {
        System.out.println(e);
}

需要更改的内容,以便我可以阅读服务器的响应。我无法访问服务器的代码,而是在本地托管。

1 个答案:

答案 0 :(得分:0)

试试这个

INSERT INTO [schema].[Table]([column1], [column2], [column3], [column4])
    EXEC 'schema.StoredProc' ;