Constructor and Description |
---|
Nio2Session(Nio2Service service,
IoHandler handler,
AsynchronousSocketChannel socket) |
Modifier and Type | Method and Description |
---|---|
IoCloseFuture |
close(boolean immediately)
Closes this session immediately or after all queued write requests
are flushed.
|
Object |
getAttribute(Object key)
Returns the value of the user-defined attribute of this session.
|
long |
getId()
Returns a unique identifier for this session.
|
SocketAddress |
getLocalAddress()
Returns the socket address of local machine which is associated with this
session.
|
SocketAddress |
getRemoteAddress()
Returns the socket address of remote peer.
|
IoService |
getService()
Returns the IoService that created this session.
|
Object |
setAttribute(Object key,
Object value)
Sets a user-defined attribute.
|
void |
startReading() |
void |
suspend() |
IoWriteFuture |
write(Buffer buffer)
Write a packet on the socket.
|
public Nio2Session(Nio2Service service, IoHandler handler, AsynchronousSocketChannel socket) throws IOException
IOException
public long getId()
IoSession
public Object getAttribute(Object key)
IoSession
getAttribute
in interface IoSession
key
- the key of the attributepublic Object setAttribute(Object key, Object value)
IoSession
setAttribute
in interface IoSession
key
- the key of the attributevalue
- the value of the attributepublic SocketAddress getRemoteAddress()
IoSession
getRemoteAddress
in interface IoSession
public SocketAddress getLocalAddress()
IoSession
getLocalAddress
in interface IoSession
public void suspend()
public IoWriteFuture write(Buffer buffer)
IoSession
public IoCloseFuture close(boolean immediately)
IoSession
CloseFuture
if you want to wait for the session actually closed.public IoService getService()
IoSession
getService
in interface IoSession
public void startReading()
Copyright © 2008–2013 The Apache Software Foundation. All rights reserved.