public interface Session extends Runnable
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the session, closing the underlying sockets
|
void |
closeDataConnection()
Close the data connection
|
Object |
getAttribute(String name)
Return the attribute value for the specified name.
|
Set |
getAttributeNames()
Return the Set of names under which attributes have been stored on this session.
|
InetAddress |
getClientHost()
Return the InetAddress representing the client host for this session
|
InetAddress |
getServerHost()
Return the InetAddress representing the server host for this session
|
boolean |
isClosed() |
void |
openDataConnection()
Open the data connection, attaching to the predefined port number on the client
|
byte[] |
readData()
Read data from the client across the data connection
|
byte[] |
readData(int numBytes)
Read and return (up to) numBytes of data from the client across the data connection
|
void |
removeAttribute(String name)
Remove the attribute value for the specified name.
|
void |
sendData(byte[] data,
int numBytes)
Write the specified data using the data connection
|
void |
sendReply(int replyCode,
String replyText)
Send the specified reply code and text across the control connection.
|
void |
setAttribute(String name,
Object value)
Store the value under the specified attribute name.
|
void |
setClientDataHost(InetAddress clientHost) |
void |
setClientDataPort(int clientDataPort) |
int |
switchToPassiveMode()
Switch to passive mode
|
void close()
boolean isClosed()
void sendReply(int replyCode, String replyText)
replyCode
- - the reply codereplyText
- - the reply text to send; may be nullvoid openDataConnection()
void closeDataConnection()
int switchToPassiveMode()
void sendData(byte[] data, int numBytes)
data
- - the data to writenumBytes
- - the number of bytes from data to sendbyte[] readData()
byte[] readData(int numBytes)
numBytes
- - the maximum number of bytes to readInetAddress getClientHost()
InetAddress getServerHost()
void setClientDataHost(InetAddress clientHost)
clientHost
- - the client host for the data connectionvoid setClientDataPort(int clientDataPort)
clientDataPort
- - the port number on the client side for the data connectionObject getAttribute(String name)
name
- - the attribute name; may not be nullAssertFailedException
- - if name is nullvoid setAttribute(String name, Object value)
name
- - the attribute name; may not be nullvalue
- - the attribute value; may be nullAssertFailedException
- - if name is nullvoid removeAttribute(String name)
name
- - the attribute name; may not be nullAssertFailedException
- - if name is nullSet getAttributeNames()
Copyright © 2016. All rights reserved.