|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.io.EchoServer
public class EchoServer
This is a base class for easy server sockets: 1. extend this class (MyServer, with default port or something for the constructor) 2. override the handleConnection(Socket socket, BufferedReader reader, PrintWriter writer) 3. Create a main with "new MyServer(port).startServer(false);"
| Field Summary | |
|---|---|
protected int |
iPort
|
protected org.apache.log4j.Logger |
log4j
|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
EchoServer(int port)
|
|
| Method Summary | |
|---|---|
protected void |
handleConnection(Socket socket)
|
protected void |
handleConnection(Socket socket,
BufferedReader reader,
PrintWriter writer)
|
static void |
main(String[] args)
Open a server on port 12345 or what is specified at the commandline |
protected void |
service()
|
void |
startServer()
Create the service detached |
void |
startServer(boolean detach)
Create the service |
void |
stopServer()
Stop the service |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
protected org.apache.log4j.Logger log4j
protected int iPort
| Constructor Detail |
|---|
public EchoServer(int port)
| Method Detail |
|---|
protected void service()
public void startServer()
public void startServer(boolean detach)
public void stopServer()
protected void handleConnection(Socket socket)
throws IOException
IOException
protected void handleConnection(Socket socket,
BufferedReader reader,
PrintWriter writer)
throws IOException
IOExceptionpublic static void main(String[] args)
args -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||