public class PyroClient extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(PyroClientListener listener) |
void |
attach(Object attachment)
Attach any object to a client, for example to store session information
|
<T> T |
attachment()
Returns the previously attached object, or
null if none is set |
void |
dropConnection()
Immediately drop the connection, regardless of any
pending outbound bytes.
|
int |
flush()
Writes as many as possible bytes to the socket buffer
|
int |
flushOrDie()
Makes an attempt to write all outbound
bytes, fails on failure.
|
InetSocketAddress |
getLocalAddress()
Returns the local socket address (host+port)
|
InetSocketAddress |
getRemoteAddress()
Returns the remove socket address (host+port)
|
boolean |
hasDataEnqueued()
Returns whether there are bytes left in the
outbound queue.
|
boolean |
isDisconnected()
Returns whether the connection is connected to a remote client.
|
void |
removeListener(PyroClientListener listener) |
void |
removeListeners() |
PyroSelector |
selector()
Returns the PyroSelector that created this client
|
void |
setEagerWrite(boolean enabled)
If enabled, causes calls to write() to make an attempt to write the bytes,
without waiting for the selector to signal writable state.
|
void |
setKeepAlive(boolean enabled) |
void |
setLinger(boolean enabled,
int seconds) |
void |
setTimeout(int ms) |
void |
shutdown()
Gracefully shuts down the connection.
|
String |
toString() |
void |
write(ByteBufferDesc data)
Will enqueue the bytes to send them
1. |
public void addListener(PyroClientListener listener)
public void removeListener(PyroClientListener listener)
public void removeListeners()
public PyroSelector selector()
public void attach(Object attachment)
public <T> T attachment()
null if none is setpublic InetSocketAddress getLocalAddress()
public InetSocketAddress getRemoteAddress()
public void setTimeout(int ms)
throws IOException
IOExceptionpublic void setLinger(boolean enabled,
int seconds)
throws IOException
IOExceptionpublic void setKeepAlive(boolean enabled)
throws IOException
IOExceptionpublic void setEagerWrite(boolean enabled)
public void write(ByteBufferDesc data) throws PyroException
PyroException - when shutdown() has been called.public int flush()
public int flushOrDie()
throws PyroException
PyroException - on failurepublic boolean hasDataEnqueued()
public void shutdown()
public void dropConnection()
public boolean isDisconnected()
Copyright © 2016. All rights reserved.