PacketReceiver<SMBPacketData<?>>, java.io.Closeable, java.lang.AutoCloseablepublic class Connection extends Pooled<Connection> implements java.io.Closeable, PacketReceiver<SMBPacketData<?>>
| Constructor | Description |
|---|---|
Connection(Connection connection) |
|
Connection(SmbConfig config,
SMBClient client,
SMBEventBus bus) |
| Modifier and Type | Method | Description |
|---|---|---|
Session |
authenticate(AuthenticationContext authContext) |
Authenticate the user on this connection in order to start a (new) session.
|
void |
close() |
|
void |
close(boolean force) |
Close the Connection.
|
void |
connect(java.lang.String hostname,
int port) |
|
SMBClient |
getClient() |
|
SmbConfig |
getConfig() |
|
ConnectionInfo |
getConnectionInfo() |
|
NegotiatedProtocol |
getNegotiatedProtocol() |
Returns the negotiated protocol details for this connection.
|
java.lang.String |
getRemoteHostname() |
|
void |
handle(SMBPacketData uncheckedPacket) |
|
void |
handleError(java.lang.Throwable t) |
|
boolean |
isConnected() |
|
<T extends SMB2Packet> |
send(SMB2Packet packet) |
send a packet.
|
public Connection(SmbConfig config, SMBClient client, SMBEventBus bus)
public Connection(Connection connection)
public SMBClient getClient()
public void connect(java.lang.String hostname,
int port)
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOExceptionpublic void close(boolean force)
throws java.io.IOException
force is set to true, it forgoes the
Session.close() operation on the open sessions, and it just calls the
TransportLayer.disconnect().
If force is set to false, the usage count of the connection is
reduced by one. If the usage count drops to zero the connection is really
closed.
force - if set, does not nicely terminate the open sessions.java.io.IOException - If any error occurred during close-ing.public SmbConfig getConfig()
public Session authenticate(AuthenticationContext authContext)
public <T extends SMB2Packet> java.util.concurrent.Future<T> send(SMB2Packet packet) throws TransportException
packet - SMBPacket to sendTransportException - When a transport level error occurredpublic NegotiatedProtocol getNegotiatedProtocol()
public void handle(SMBPacketData uncheckedPacket) throws TransportException
handle in interface PacketReceiver<SMBPacketData<?>>TransportExceptionpublic void handleError(java.lang.Throwable t)
handleError in interface PacketReceiver<SMBPacketData<?>>public java.lang.String getRemoteHostname()
public boolean isConnected()
public ConnectionInfo getConnectionInfo()