Good afternoon, there is a server
public class Server_main implements Runnable { private ServerSocket server; private Socket client; /*****************STREAM*****************/ static private BufferedOutputStream output; static private BufferedInputStream input; /***************************************/ public static void main(String[] args) { new Thread (new Server_main()).start(); } @Override public void run() { // TODO Auto-generated method stub byte[] byteArray = new byte[8192]; int in; try { server= new ServerSocket(60000/*Π½ΠΎΠΌΠ΅Ρ ΠΏΠΎΡΡΠ°*/, 10/*ΠΊΠΎΠ»Π»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ΅Π½ΠΈΠΉ*/); client= server.accept(); output = new BufferedOutputStream(new FileOutputStream("D:/")); input = new BufferedInputStream(client.getInputStream()); while ((in = input.read(byteArray)) != -1){ output.write(byteArray,0,in); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { output.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } which after receiving the file stops working. After that, it must be run again manually. The question is where in the code to register the cycle for its uninterrupted work?