public class PubClient extends ReceiverAdapter implements ConnectionListener
PubServer) and sends it messages which are forwarded to all
connected clients| Modifier and Type | Field and Description |
|---|---|
protected BaseServer |
client |
protected java.io.InputStream |
in |
protected java.lang.String |
name |
protected boolean |
running |
| Constructor and Description |
|---|
PubClient(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
connectionClosed(Connection conn,
java.lang.String cause) |
void |
connectionEstablished(Connection conn) |
protected void |
eventLoop() |
protected static void |
help() |
static void |
main(java.lang.String[] args) |
void |
receive(Address sender,
byte[] buf,
int offset,
int length)
Delivers a message from a given sender to the application
|
void |
receive(Address sender,
java.nio.ByteBuffer buf)
The default implementation assumes that
Buffer.flip() or Buffer.rewind() was called on
buf before invoking this callback |
protected void |
start(java.net.InetAddress srv_addr,
int srv_port,
boolean nio) |
protected BaseServer client
protected final java.lang.String name
protected volatile boolean running
protected java.io.InputStream in
public void receive(Address sender, java.nio.ByteBuffer buf)
ReceiverAdapterBuffer.flip() or Buffer.rewind() was called on
buf before invoking this callbackreceive in interface Receiverreceive in class ReceiverAdaptersender - The sender of the messagebuf - The buffer. An application typically de-serializes data from the buffer into objects used by the
application. Note that when receive() returns, it is not safe to use the buffer any longer;
if an application needs to use a buffer after this callback returns, it must make a copy.
Note that buf could be a direct ByteBuffer.public void receive(Address sender, byte[] buf, int offset, int length)
Receiverreceive in interface Receiverreceive in class ReceiverAdaptersender - The sender of the messagebuf - The buffer. An application typically de-serializes data from the buffer into objects used by the
application. Note that when receive() returns, it is not safe to use the buffer any longer;
if an application needs to use a buffer after this callback returns, it must make a copy.offset - The offset at which the received data startslength - The length of the received datapublic void connectionClosed(Connection conn, java.lang.String cause)
connectionClosed in interface ConnectionListenerpublic void connectionEstablished(Connection conn)
connectionEstablished in interface ConnectionListenerprotected void start(java.net.InetAddress srv_addr,
int srv_port,
boolean nio)
throws java.lang.Exception
java.lang.Exceptionprotected void eventLoop()
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exceptionprotected static void help()
Copyright © 1998-2020 Red Hat. All Rights Reserved.