public interface SocketConnectionFacade
It hides the details of the underlying I/O system used for socket communication.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the socket connection including its input and output stream and
frees all associated ressources.
|
void |
flush()
Flushes the socket connection by sending any buffered but yet unsent
data.
|
InetAddress |
getLocalAddress()
Returns the local address this socket connection.
|
int |
getLocalPort()
Returns the local port of this socket connection.
|
InetAddress |
getRemoteAddress()
Returns the remote address of this socket connection.
|
int |
getRemotePort()
Returns the remote port of this socket connection.
|
boolean |
isConnected()
Returns the connection state of the socket.
|
String |
readLine()
Reads a line of text from the socket connection.
|
void |
write(String s)
Sends a given String to the socket connection.
|
String readLine() throws IOException
Depending on the implementation different newline delimiters are used ("\r\n" for the Manager API and "\n" for AGI).
IOException
- if the connection has been closed.void write(String s) throws IOException
s
- the String to send.IOException
- if the String cannot be sent, maybe because the
connection has already been closed.void flush() throws IOException
IOException
- if the connection cannot be flushed.void close() throws IOException
When calling close() any Thread currently blocked by a call to readLine() will be unblocked and receive an IOException.
IOException
- if the socket connection cannot be closed.boolean isConnected()
true
if the socket successfuly connected to a
serverInetAddress getLocalAddress()
int getLocalPort()
InetAddress getRemoteAddress()
int getRemotePort()
Copyright © 2004–2017. All rights reserved.