public final class TcpClient extends Object implements Closeable
Socket.Socket(InetAddress, int)
.
Adds a data logging facility, and has idempotent getInputStream()
and getOutputStream()
methods (as opposed to Socket
).
Data logging is enabled by setting the level of logger de.unkrig.commons.net.TcpClient
to Level.FINEST
or higher.
TcpClient(InetAddress, int)
Constructor and Description |
---|
TcpClient(InetAddress address,
int port)
Connects to the given address and port.
|
TcpClient(String host,
int port) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
SocketAddress |
getRemoteSocketAddress() |
public TcpClient(String host, int port) throws IOException
IOException
TcpClient(InetAddress, int)
public TcpClient(InetAddress address, int port) throws IOException
OutputStream
returned by getOutputStream()
, and data can be read from the remote server
through the InputStream
returned by getInputStream()
.IOException
public InputStream getInputStream()
public OutputStream getOutputStream()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public SocketAddress getRemoteSocketAddress()
Copyright © 2018 Arno Unkrig. All rights reserved.