public class NetworkManager extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_MSG_LENGTH
Maximum length message that a connection will be able to receive.
|
static boolean |
TheDebugReplyFlag
Special debug support: if this flag is set to true, errors generated by
received messages will result in a 'debug' message being sent in reply.
|
Constructor and Description |
---|
NetworkManager(ConnectionCountMonitor connectionCountMonitor,
BootProperties props,
LoadMonitor loadMonitor,
Runner runner)
Construct a NetworkManager for this server.
|
Modifier and Type | Method and Description |
---|---|
void |
connectionCount(int adjust)
Keep track of the number of connections.
|
void |
connectTCP(String hostPort,
MessageHandlerFactory handlerFactory,
ByteIOFramerFactory framerFactory,
Trace trace)
Make a TCP connection to another host given a host:port address.
|
void |
connectVia(String connectionManagerClassName,
String propRoot,
String hostPort,
MessageHandlerFactory handlerFactory,
Trace msgTrace)
Make a connection to another host given a host:port address using a
named connection manager class.
|
NetAddr |
listenHTTP(String listenAddress,
MessageHandlerFactory innerHandlerFactory,
String rootURI,
HTTPFramer httpFramer,
boolean secure,
Trace trace)
Begin listening for incoming HTTP connections on some port.
|
NetAddr |
listenRTCP(String listenAddress,
MessageHandlerFactory innerHandlerFactory,
Trace msgTrace,
boolean secure)
Begin listening for incoming RTCP connections on some port.
|
NetAddr |
listenTCP(String listenAddress,
MessageHandlerFactory handlerFactory,
ByteIOFramerFactory framerFactory,
boolean secure,
Trace portTrace)
Begin listening for incoming TCP connections on some port.
|
NetAddr |
listenVia(String connectionManagerClassName,
String propRoot,
String listenAddress,
MessageHandlerFactory handlerFactory,
Trace msgTrace,
boolean secure)
Begin listening for incoming connections on some port using a named
connection manager class.
|
NetAddr |
listenWebSocket(String listenAddress,
MessageHandlerFactory innerHandlerFactory,
String socketURI,
Trace msgTrace,
boolean secure)
Begin listening for incoming WebSocket connections on some port.
|
BootProperties |
props()
Get this server's properties.
|
public static final int MAX_MSG_LENGTH
public static boolean TheDebugReplyFlag
public NetworkManager(ConnectionCountMonitor connectionCountMonitor, BootProperties props, LoadMonitor loadMonitor, Runner runner)
connectionCountMonitor
- Monitor for tracking session count.props
- Boot properties for this server.loadMonitor
- Load monitor for tracking system load.runner
- The Runner managing this server's run queue.public void connectionCount(int adjust)
adjust
- Adjustment being made to the number of active
connections, plus or minus.public void connectTCP(String hostPort, MessageHandlerFactory handlerFactory, ByteIOFramerFactory framerFactory, Trace trace)
hostPort
- The host name (or IP address) and port to connect to,
separated by a colon. For example, "bithlo.example.com:8002".handlerFactory
- Message handler factory to provide the handler
for the connection that results from this operation.framerFactory
- Byte I/O framer factory for the new connection.trace
- Trace object to use for activity on the new connection.public void connectVia(String connectionManagerClassName, String propRoot, String hostPort, MessageHandlerFactory handlerFactory, Trace msgTrace)
connectionManagerClassName
- Fully qualified class name of the
connection manager class to use to make this connection.propRoot
- Prefix string for all the properties describing the
connection that is to be made.hostPort
- The host name (or IP address) and port to connect to,
separated by a colon. For example, "bithlo.example.com:8002".handlerFactory
- Message handler factory to provide the handler
for the connection that results from this operation.msgTrace
- Trace object for logging message traffic.public NetAddr listenHTTP(String listenAddress, MessageHandlerFactory innerHandlerFactory, String rootURI, HTTPFramer httpFramer, boolean secure, Trace trace) throws IOException
listenAddress
- Host name and port to listen for connections on.innerHandlerFactory
- Message handler factory to provide message
handlers for messages passed inside HTTP requests on connections made
to this port.rootURI
- The root URI that GETs and POSTs must reference.httpFramer
- HTTP framer to interpret HTTP POSTs and format HTTP
replies.secure
- If true, use SSL.trace
- Trace object to use for activity on this connection.IOException
public NetAddr listenRTCP(String listenAddress, MessageHandlerFactory innerHandlerFactory, Trace msgTrace, boolean secure) throws IOException
listenAddress
- Host name and port to listen for connections on.innerHandlerFactory
- Message handler factory to provide message
handlers for messages passed inside RTCP requests on connections made
to this port.msgTrace
- Trace object for logging message trafficesecure
- If true, use SSL.IOException
public NetAddr listenWebSocket(String listenAddress, MessageHandlerFactory innerHandlerFactory, String socketURI, Trace msgTrace, boolean secure) throws IOException
listenAddress
- Host name and port to listen for connections on.innerHandlerFactory
- Message handler factory to provide message
handlers for messages passed inside WebSocket frames on connections
made to this port.socketURI
- The WebSocket URI that browsers connect tomsgTrace
- Trace object for logging message trafficesecure
- If true, use SSL.IOException
public NetAddr listenTCP(String listenAddress, MessageHandlerFactory handlerFactory, ByteIOFramerFactory framerFactory, boolean secure, Trace portTrace) throws IOException
listenAddress
- Host name and port to listen for connections on.handlerFactory
- Message handler factory to provide message
handlers for connections made to this port.framerFactory
- Byte I/O framer factory for the new connection.secure
- If true, use SSL.portTrace
- Trace object for logging activity associated with this
port & its connectionsIOException
public NetAddr listenVia(String connectionManagerClassName, String propRoot, String listenAddress, MessageHandlerFactory handlerFactory, Trace msgTrace, boolean secure) throws IOException
connectionManagerClassName
- Fully qualified class name of the
connection manager class to use to make this connection.propRoot
- Prefix string for all the properties describing the
listener that is to be started.listenAddress
- Host name and port to listen for connections on.handlerFactory
- Message handler factory to provide message
handlers for connections made to this port.msgTrace
- Trace object for logging message traffic.secure
- If true, use a secure connection pathway (e.g., SSL).IOException
- if the requested connection manager was unavailable.public BootProperties props()
Copyright © 2017. All rights reserved.