| This interface defines the methods
that should be implemented by any class that
wants to handle java Objects from a client.
Recommendations to be followed when implementing ClientBinaryHandler
- Should have a default constructor.
- Should be thread safe.
- It should not store any data that may is associated with a particular client.
- If any client data is need to be saved from the client session,
it should be saved to a
ClientData class, which can be retrieved
using handler.getClientData() method.
Ex:
package dateserver;
import java.net.*;
import java.io.*;
import java.util.Date;
import org.quickserver.net.server.*;
public class BinaryHandler implements ClientBinaryHandler {
public void handleBinary(ClientHandler handler, byte command[]))
throws SocketTimeoutException, IOException {
handler.sendSystemMsg("Got Binary : " + new String(command));
}
}
author: Akshathkumar Shetty since: 1.4 |