FileOutputStream os = new FileOutputStream("conten.txt");
byte[] but = new byte[1024];
int len = 0;
while((len=in.read(but))!=-1){
os.write(but,0,len);
}
os.close();
s.close();
}catch(Exception e){
throw new RuntimeException("失败");
}
}
}
//服务端,循环获取客户端,并循环建立线程
class picServer{
public static void main(String[] args)throws Exception{
ServerSocket service = new ServerSocket(10001);
while(true){
Socket s = service.accept();
new Thread(new picThread(s)).start();
}
}