public static class PojoClientServer.SingleConnection extends Object
| Constructor and Description |
|---|
SingleConnection(int id,
Socket client,
org.sfj.PojoClientServer.Encoder encoder,
org.sfj.PojoClientServer.Decoder decoder,
Consumer<PojoClientServer.SingleConnection> onClose) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Non failing close().
|
int |
getId()
ID for this connection/
|
Throwable |
getLastIgnoredThrowable()
Get the last ignored exception
|
Socket |
getSocket() |
boolean |
isAlive() |
Object |
receive()
Just receive a message.
|
void |
send(Object msg)
Send a message, don't wait.
|
Object |
sendAndReceive(Object msg)
Send and receive a message; wait until done.
|
String |
toString() |
public SingleConnection(int id,
Socket client,
org.sfj.PojoClientServer.Encoder encoder,
org.sfj.PojoClientServer.Decoder decoder,
Consumer<PojoClientServer.SingleConnection> onClose)
throws IOException
IOExceptionpublic Throwable getLastIgnoredThrowable()
public int getId()
public boolean isAlive()
public Socket getSocket()
public void close()
public void send(Object msg) throws IOException
msg - message objectIOException - on send failurepublic Object sendAndReceive(Object msg) throws IOException
msg - message to sendIOException - on read/write exceptionpublic Object receive() throws IOException
IOException - on read exceptionCopyright © 2020. All rights reserved.