1 14 15 package echoserver; 16 17 import java.net.*; 18 import java.io.*; 19 import org.quickserver.net.server.ClientExtendedEventHandler; 20 import org.quickserver.net.server.ClientHandler; 21 import java.util.logging.*; 22 23 public class EchoExtendedEventHandler implements ClientExtendedEventHandler { 24 private static Logger logger = 25 Logger.getLogger(EchoExtendedEventHandler.class.getName()); 26 27 public void handleTimeout(ClientHandler handler) 28 throws SocketException, IOException { 29 handler.sendClientMsg("-ERR Timeout"); 30 if(true) throw new SocketException(); 31 } 32 33 public void handleMaxAuthTry(ClientHandler handler) throws IOException { 34 handler.sendClientMsg("-ERR Max Auth Try Reached"); 35 } 36 37 public boolean handleMaxConnection(ClientHandler handler) throws IOException { 38 if(true) { 40 handler.sendClientMsg("Server Busy - Max Connection Reached"); 41 return false; 42 } 43 return true; 44 } 45 } | Popular Tags |