public final class TcpClient extends Object implements SocketClient
SocketClient implementation allows the reading and writing to and from a specific connected TCP Socket.| Constructor and Description |
|---|
TcpClient(Socket socket,
TcpProtocol protocol) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection that was held by the client, leaving it unusable.
|
SocketAttributes |
getAttributes() |
InputStream |
read()
This methods blocks until new data is available or
SocketProperties.getClientTimeout() is reached, in which case a
ReadingTimeoutException is thrown. |
void |
write(Object data,
String outputEncoding) |
public TcpClient(Socket socket, TcpProtocol protocol)
public void write(Object data, String outputEncoding) throws IOException
write in interface SocketClientdata - to be written into the socketoutputEncoding - to be used when writing contents of type String. If not specified, it defaults to the encoding
specified in the config AbstractSocketConfig. If no default is specified AbstractSocketConfig either,
mule's default encoding is used.IOExceptionpublic InputStream read() throws IOException
SocketProperties.getClientTimeout() is reached, in which case a
ReadingTimeoutException is thrown.read in interface SocketClientInputStream with the information read from the socket.IOExceptionpublic void close()
throws IOException
close in interface SocketClientIOException - if an I/O error occurs when closing the socketpublic SocketAttributes getAttributes()
getAttributes in interface SocketClientSocketAttributes with information associated to the client's connection.Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.