1 package org.apache.axis2.transport.mail.server; 2 3 import java.io.IOException ; 4 import java.net.ServerSocket ; 5 import java.net.Socket ; 6 7 import org.apache.axis2.engine.AxisFault; 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 13 14 public class POP3Server extends Thread { 15 protected static Log log = LogFactory.getLog(POP3Server.class.getName()); 16 private ServerSocket serverSocket; 17 private Storage st = null; 18 19 20 public POP3Server(Storage st,int port) throws AxisFault { 21 this.st = st; 22 try { 23 serverSocket = new ServerSocket (port); 24 System.out.println("Server started on port " + port); 25 } catch(IOException e) { 26 throw new AxisFault(e); 27 } 28 } 29 30 public void run() { 31 while(true) { 32 try { 33 Socket socket = serverSocket.accept(); 34 POP3Worker thread = new POP3Worker(socket, st); 35 thread.start(); 36 } catch(Exception e) { 37 log.error(e); 38 } 39 } 40 } 41 } | Popular Tags |