public pop3server() { try{ listenSocket=new ServerSocket(SERVER_PORT,MAX_CLIENT); }catch(IOException excpt){ System.err.println("SOrry to open port "+SERVER_PORT+":"+excpt); System.exit(1); } } }
/*follow is manage and process command class*/
class manageconnection implements Runnable{ private static final boolean AUTOFLUSH=true; private Socket mySocket=null; private PrintWriter out=null; private BufferedReader in=null; private boolean checkedpass=false; private int msgnum=0; private long[] msgsize=new long[100]; private long totalsize=0; private String username=null; public manageconnection(Socket newSocket){ mySocket=newSocket; } public void run(){ String nextline=null; String password; int check=0; int strlen; String content="Subject:hello"; String command=null; String auth_user="user"; String arg1; int arg2=0; String arg3; int i=0; int count=0; int time=0; try{Thread.currentThread().sleep(10); }catch(Exception e){ System.out.println(e); } try{ mySocket.setTcpNoDelay(true); time=mySocket.getSoTimeout(); }catch(SocketException excpt){ System.out.println(excpt); } try{ out=new PrintWriter(mySocket.getOutputStream(),AUTOFLUSH); in=new BufferedReader(new InputStreamReader(mySocket.getInputStream())
private int readmail(String uname){ String[] arg=new String[1]; arg[0]="username="+uname; int[] msg=new int[3]; int i=0,j=0; int msgnum=0; int c; try{ Process child=Runtime.getRuntime().exec("/disk2/ftp/pub/readmail",