package ignisftpv20; import java.net.*; import java.io.*; import javax.swing.JOptionPane; public class FTPServer { ObjectInputStream input; ObjectOutputStream output; Socket soc ; public FTPServer(){ waitForConnection(); } public void waitForConnection(){ try{ ServerSocket ss = new ServerSocket(5555); while(true){ soc = ss.accept(); JOptionPane.showMessageDialog(null, "Server says: OK ... I got a connection!"); setIOStreams(); System.out.println("Connected from: "+ soc.getInetAddress().getHostName()+"..." ); new FTPServerReceiver( this, soc ); } }catch(Exception e){ e.printStackTrace();} } public void setIOStreams(){ try{ output = new ObjectOutputStream(soc.getOutputStream()); output.flush(); // flush output buffer to send header information input = new ObjectInputStream(soc.getInputStream()); JOptionPane.showMessageDialog(null, "Server says: SetIO Streams Ready..."); }catch(Exception e){e.printStackTrace();} } }