Package com.hierynomus.smbj
Class SMBClient
- java.lang.Object
-
- com.hierynomus.smbj.SMBClient
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class SMBClient extends java.lang.Object implements java.io.Closeable
Server Message Block Client API.
-
-
Field Summary
Fields Modifier and Type Field Description private SMBEventBus
bus
private SmbConfig
config
private java.util.Map<java.lang.String,Connection>
connectionTable
static int
DEFAULT_PORT
The default TCP port for SMBprivate static org.slf4j.Logger
logger
private ServerList
serverList
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Connection
connect(java.lang.String hostname)
Connect to the host atConnection
connect(java.lang.String hostname, int port)
Connect to the host atprivate void
connectionClosed(ConnectionClosed event)
private Connection
getEstablishedOrConnect(java.lang.String hostname, int port)
ServerList
getServerList()
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
The default TCP port for SMB- See Also:
- Constant Field Values
-
connectionTable
private java.util.Map<java.lang.String,Connection> connectionTable
-
serverList
private ServerList serverList
-
config
private SmbConfig config
-
bus
private SMBEventBus bus
-
logger
private static final org.slf4j.Logger logger
-
-
Constructor Detail
-
SMBClient
public SMBClient()
-
SMBClient
public SMBClient(SmbConfig config)
-
SMBClient
public SMBClient(SmbConfig config, SMBEventBus bus)
-
-
Method Detail
-
connect
public Connection connect(java.lang.String hostname) throws java.io.IOException
Connect to the host athostname
on the default port (445)- Parameters:
hostname
- The hostname to connect to.- Returns:
- An established connection.
- Throws:
java.io.IOException
- If the connection could not be established.
-
connect
public Connection connect(java.lang.String hostname, int port) throws java.io.IOException
Connect to the host athostname
on the given port- Parameters:
hostname
- The hostname to connect to.port
- The port to connect to- Returns:
- An established connection.
- Throws:
java.io.IOException
- If the connection could not be established.
-
getEstablishedOrConnect
private Connection getEstablishedOrConnect(java.lang.String hostname, int port) throws java.io.IOException
- Throws:
java.io.IOException
-
connectionClosed
private void connectionClosed(ConnectionClosed event)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
getServerList
public ServerList getServerList()
-
-