|
QuickServer v1.4.6 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines the methods that should be implemented by any class that wants to handle extended client events.
Recommendations to be followed when implementing ClientExtendedEventHandler
ClientData
class, which can be retrieved
using handler.getClientData() method.
Ex:
package echoserver;
import java.net.*;
import java.io.*;
import org.quickserver.net.server.ClientExtendedEventHandler;
import org.quickserver.net.server.ClientHandler;
public class EchoExtendedEventHandler implements ClientExtendedEventHandler {
public void handleTimeout(ClientHandler handler)
throws SocketException, IOException {
handler.sendClientMsg("-ERR Timeout");
if(true) throw new SocketException();
}
public void handleMaxAuthTry(ClientHandler handler) throws IOException {
handler.sendClientMsg("-ERR Max Auth Try Reached");
}
public boolean handleMaxConnection(ClientHandler handler) throws IOException {
//for now lets reject all excess clients
if(true) {
handler.sendClientMsg("Server Busy - Max Connection Reached");
return false;
}
}
}
Method Summary | |
void |
handleMaxAuthTry(ClientHandler handler)
Method called when client has reached maximum auth tries. |
boolean |
handleMaxConnection(ClientHandler handler)
Method called when maximum number of clients has been reached and a new client connects. |
void |
handleTimeout(ClientHandler handler)
Method called when client timeouts. |
Method Detail |
public void handleTimeout(ClientHandler handler) throws java.net.SocketException, java.io.IOException
java.net.SocketException
- if client socket needs to be closed.
java.io.IOException
- if io error in socketpublic void handleMaxAuthTry(ClientHandler handler) throws java.io.IOException
java.io.IOException
- if io error in socketpublic boolean handleMaxConnection(ClientHandler handler) throws java.io.IOException
true
the
client is accepted else client connection is closed.
java.io.IOException
- if io error in socket
|
QuickServer v1.4.6 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |