jrun.jms.core.kernel.ipc
Class TcpServerService
java.lang.Object
|
+--jrun.jms.core.kernel.ipc.TcpServerService
- All Implemented Interfaces:
- IpcServerIfc
- public class TcpServerService
- extends java.lang.Object
- implements IpcServerIfc
Create a listener socket and wait for requests to come in. When a connection
is made add the new object to the list of active connections and spawn a
new thread to listen to the connection.
- Version:
- $Revision: 1.3 $ $Date: 2001/10/25 11:57:50 $
- Author:
- Jim Mourikis
- See Also:
org.exolab.core.ipc.IpcServerService,
org.exolab.core.ipc.TcpService,
org.exolab.core.ipc.Server
|
Constructor Summary |
TcpServerService(int port,
NotifierIfc notifier)
Sets up a listener port and adds a notifier to call with all received
messages. |
TcpServerService(NotifierIfc notifier)
Sets up a listener port on the next free port as allocated by the
system and adds a notifier to call with all received messages. |
|
Method Summary |
java.lang.String |
getHost()
Return the machines address. |
int |
getPort()
Return the port number this server is listening on. |
void |
shutdownAll()
Shutdown all active connections, including the server connection. |
void |
start()
Start the service running. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TcpServerService
public TcpServerService(NotifierIfc notifier)
throws java.io.IOException
- Sets up a listener port on the next free port as allocated by the
system and adds a notifier to call with all received messages.
- Parameters:
notifier - The client handle to call when data is received.
TcpServerService
public TcpServerService(int port,
NotifierIfc notifier)
throws java.io.IOException
- Sets up a listener port and adds a notifier to call with all received
messages.
- Parameters:
port - The port to connect on.notifier - The client handle to call when data is received.
start
public void start()
- Start the service running. This call never returns until the service
is shutdown.
When a connection is made, the new socket is added to the connections
list, and a new thread is spawned to receive messages from the socket.
- Specified by:
start in interface IpcServerIfc
- Throws:
java.io.IOException - If a failure on connection occurs.
shutdownAll
public void shutdownAll()
throws java.io.IOException
- Shutdown all active connections, including the server connection.
- Specified by:
shutdownAll in interface IpcServerIfc
- Parameters:
ipc - The service to shutdown.- Throws:
java.io.IOException - If the service reports an error during shutdown.
getPort
public int getPort()
- Return the port number this server is listening on.
- Specified by:
getPort in interface IpcServerIfc
- Returns:
- int The port number the server is using.
getHost
public java.lang.String getHost()
- Return the machines address.
- Specified by:
getHost in interface IpcServerIfc
- Returns:
- String The machines Ip address.
Copyright � 2002 Macromedia Corporation. All Rights Reserved.