80,356
社区成员
发帖
与我相关
我的任务
分享
try {
if (inputStream != null) {
inputStream.close();
}
} finally {
try {
if (outputStream != null) {
outputStream.close();
}
} finally {
if (socket != null && !socket.isClosed()) {
socket.close();
}
}
}
socket = null;
inputStream = null;
outputStream = null;
Socket socket = new Socket();
socket.connect(new InetSocketAddress(host, port),
20000);
outputStream = socket.getOutputStream();
inputStream = socket.getInputStream();