67,513
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(51706);
while (true) {
System.out.println("loading");
Socket socket = serverSocket.accept();
System.out.println("accept");
try{
File dir=new File("/usr/test/");
File[] files=dir.listFiles();
for(File f:files){
String af=f.getAbsolutePath();
System.out.println("full name:"+af);
System.out.println("is exist:"+f.exists());
System.out.println("name :"+f.getName());
System.out.println("size:"+f.length());
}
}catch (Exception e) {
e.printStackTrace();
} finally {
socket.close();
}
}
}catch (Exception e) {
e.printStackTrace();
}
}