QuickServer
v1.4.7

org.quickserver.net.server
Interface ClientCommandHandler

All Known Implementing Classes:
CommandHandler

public interface ClientCommandHandler

This interface defines the methods that should be implemented by any class that wants to handle character/string data from client.

Recommendations to be followed when implementing ClientCommandHandler

Ex:

package echoserver;

import java.net.*;
import java.io.*;
import org.quickserver.net.server.ClientCommandHandler;
import org.quickserver.net.server.ClientHandler;

public class EchoCommandHandler implements ClientCommandHandler {

        public void handleCommand(ClientHandler handler, String command)
                        throws SocketTimeoutException, IOException {
                if(command.toLowerCase().equals("quit")) {
                        handler.sendClientMsg("Bye ;-)");
                        handler.closeConnection();
                } else {
                        handler.sendClientMsg("Echo : " + command);
                }
        }
}

Author:
Akshathkumar Shetty

Method Summary
 void handleCommand(ClientHandler handler, java.lang.String command)
          Method called every time client sends character/string data.
 

Method Detail

handleCommand

public void handleCommand(ClientHandler handler,
                          java.lang.String command)
                   throws java.net.SocketTimeoutException,
                          java.io.IOException
Method called every time client sends character/string data. Should be used to handle the command sent and send any requested data.

Throws:
java.net.SocketTimeoutException - if socket times out
java.io.IOException - if io error in socket

QuickServer
v1.4.7

Copyright © 2003-2006 QuickServer.org