public interface Connector
start() method has been invoked,
applications can use the send(RawData) method to send messages
(wrapped in a RawData object) to a client via the network. Processing of
messages received from clients is delegated to the handler registered via the
setRawDataReceiver(RawDataChannel) method.
Implementations of the send(RawData) method should be non-blocking
to allow the server application to continue working on other tasks. This could
be achieved by buffering outbound messages in a queue and off-loading the sending
of messages via the network to a separate Thread.| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Stops the connector and cleans up any leftovers.
|
InetSocketAddress |
getAddress()
Gets the address of the socket this connector is bound to.
|
void |
send(RawData msg)
Sends a raw message to a client via the network.
|
void |
setRawDataReceiver(RawDataChannel messageHandler)
Sets the handler for incoming messages.
|
void |
start()
Starts the connector.
|
void |
stop()
Stops the connector.
|
void start()
throws IOException
IOException - Signals that an I/O exception has occurred.void stop()
start() method.void destroy()
void send(RawData msg)
msg - the message to be sentvoid setRawDataReceiver(RawDataChannel messageHandler)
RawDataChannel.receiveData(RawData) method
will be called whenever a new message from a client has been received
via the network.messageHandler - the message handlerInetSocketAddress getAddress()
Copyright © 2019 Eclipse Foundation. All rights reserved.