edu.berkeley.guir.lib.net
Class GenericServer
java.lang.Object
|
+--java.lang.Thread
|
+--edu.berkeley.guir.lib.net.GenericServer
- All Implemented Interfaces:
- NetConstants, Runnable
- Direct Known Subclasses:
- Proxy
- public class GenericServer
- extends Thread
- implements NetConstants
Listens on a port and echoes to the screen every message received.
Once a connection is made, it must send a message periodically or the
socket will timeout.
This software is distributed under the
Berkeley Software License.
Revisions: - GUIRLib-v1.2-1.0.0, Jul 19 2000, JH
Created class
- GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
Touched for GUIRLib release
- GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
Touched for GUIRLib release
- Since:
- 1.1.2
- Version:
- GUIRLib-v1.4-1.0.0, Aug 31 2000
- Author:
- Jason Hong (
jasonh@cs.berkeley.edu
Method Summary |
void |
close()
Close the server. |
static void |
main(String[] argv)
|
void |
run()
|
void |
setPlugin(ServerPlugin plugin)
Set the plugin for this server, which is called when major events
happen (like a new connection, data arrives, etc). |
void |
setServerPort(int port)
Set the port the server will listen on. |
void |
setTimeout(int time)
Set the timeout value for this proxy. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
GenericServer
protected GenericServer()
- Just in case this class ever needs to be subclassed.
GenericServer
public GenericServer(int port)
- Create a server listening on the specified port.
- Parameters:
port
- is the port number to listen on.
GenericServer
public GenericServer(int port,
int timeout)
- Create a server listening on the specified port with the specified
timeout.
- Parameters:
port
- is the port to listen on.timeout
- is the timeout for the system.
GenericServer
public GenericServer(InetAddress addr,
int port)
GenericServer
public GenericServer(InetAddress addr,
int port,
int timeout)
setServerPort
public void setServerPort(int port)
- Set the port the server will listen on.
- Parameters:
port
- is the port number to listen to.
close
public void close()
- Close the server.
setTimeout
public void setTimeout(int time)
- Set the timeout value for this proxy. Any non-positive values will be
interpreted as having no timeout set.
- Parameters:
time
- is the timeout value.
setPlugin
public void setPlugin(ServerPlugin plugin)
- Set the plugin for this server, which is called when major events
happen (like a new connection, data arrives, etc).
- Parameters:
plugin
- is the plugin to set to. Ignores null.
run
public void run()
- Overrides:
run
in class Thread
main
public static void main(String[] argv)
throws Exception