01: /*
02: * This file is part of the QuickServer library
03: * Copyright (C) 2003-2005 QuickServer.org
04: *
05: * Use, modification, copying and distribution of this software is subject to
06: * the terms and conditions of the GNU Lesser General Public License.
07: * You should have received a copy of the GNU LGP License along with this
08: * library; if not, you can download a copy from <http://www.quickserver.org/>.
09: *
10: * For questions, suggestions, bug-reports, enhancement-requests etc.
11: * visit http://www.quickserver.org
12: *
13: */
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
24: ClientExtendedEventHandler {
25: private static Logger logger = Logger
26: .getLogger(EchoExtendedEventHandler.class.getName());
27:
28: public void handleTimeout(ClientHandler handler)
29: throws SocketException, IOException {
30: handler.sendClientMsg("-ERR Timeout");
31: if (true)
32: throw new SocketException();
33: }
34:
35: public void handleMaxAuthTry(ClientHandler handler)
36: throws IOException {
37: handler.sendClientMsg("-ERR Max Auth Try Reached");
38: }
39:
40: public boolean handleMaxConnection(ClientHandler handler)
41: throws IOException {
42: //for now lets reject all excess clients
43: if (true) {
44: handler
45: .sendClientMsg("Server Busy - Max Connection Reached");
46: return false;
47: }
48: return true;
49: }
50: }
|