套接字客户端在android上运行:try { socketClient = new Socket(host, port); //set socket input in = socketClient.getInputStream(); dIn = new DataInputStream(in); //set socket output out = socketClient.getOutputStream(); dOut = new DataOutputStream(out); int c = 0; String data = ""; while ((c = dIn.read()) != -1) { //print data }} catch (Exception e) { //close connection}我的服务器在 python 上运行并且一切正常,除非服务器未运行并且当我尝试连接到服务器时需要两分钟才能捕获服务器不可用的错误如何减少时间例如捕获错误在 10 秒内
添加回答
举报
0/150
提交
取消