@Override
		public void run() {
			try{
				ServerSocket serverSocket = new ServerSocket(DefaultNetworkVariables.DEFAULT_FTP_PORT);
				serverSocket.setSoTimeout(THREAD_HEARTBEAT);
				while (alive){
					try {
						//System.out.println("DEBUG: Accepting new FTP requests");
						final Socket s = serverSocket.accept();
						OutputStream os = new BufferedOutputStream(s.getOutputStream());
						
						System.out.println("DEBUG: Accepted new FTP request from " + s.getRemoteSocketAddress());
						
						final String remote = directUploadSession(s.getInputStream(), s.getOutputStream());
						
						if (remote != null){
							System.out.println("DEBUG: Remote invocation detected: starting download session " + remote);
							download(s.getInputStream(), s.getOutputStream(), remote, "");
							s.close();
							continue;
						}
						
						os.close();
						s.close();
					} catch (ClassNotFoundException e) {
						System.err.println("Failed to read session descriptor from stream!");
					} catch (SocketTimeoutException e) {
						//Heartbeat, do nothing
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
				serverSocket.close();
			} catch (IOException e){
				error = true;
				e.printStackTrace();
			}
		}