Package org.jgroups.demos
Class PubClient
java.lang.Object
org.jgroups.demos.PubClient
- All Implemented Interfaces:
ConnectionListener,Receiver
Demo of a client which connects to a server (
PubServer) and sends it messages which are forwarded to all
connected clients- Since:
- 3.6.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BaseServerprotected InputStreamprotected final Stringprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectionClosed(Connection conn) voidprotected voidprotected static voidhelp()static voidvoidDelivers a message from a given sender to the applicationvoidReceive data from the given sendervoidreceive(Address sender, ByteBuffer buf) Delivers a message from a given sender to the applicationprotected voidprotected voidstart(InetAddress srv_addr, int srv_port, boolean nio)
-
Field Details
-
client
-
name
-
running
protected volatile boolean running -
in
-
-
Constructor Details
-
PubClient
-
-
Method Details
-
receive
Description copied from interface:ReceiverDelivers a message from a given sender to the application- Specified by:
receivein interfaceReceiver- Parameters:
sender- 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.
-
receive
Description copied from interface:ReceiverDelivers a message from a given sender to the application- Specified by:
receivein interfaceReceiver- Parameters:
sender- 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 data
-
receive
Description copied from interface:ReceiverReceive data from the given sender -
connectionClosed
- Specified by:
connectionClosedin interfaceConnectionListener
-
connectionEstablished
- Specified by:
connectionEstablishedin interfaceConnectionListener
-
start
- Throws:
Exception
-
eventLoop
protected void eventLoop() -
send
- Throws:
Exception
-
main
- Throws:
Exception
-
help
protected static void help()
-