Class 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
      static int DEFAULT_PORT
      The default TCP port for SMB
    • Method Summary

      Modifier and Type Method Description
      void close()  
      Connection connect​(java.lang.String hostname)
      Connect to the host at
      Connection connect​(java.lang.String hostname, int port)
      Connect to the host at
      ServerList getServerList()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_PORT

        public static final int DEFAULT_PORT
        The default TCP port for SMB
        See Also:
        Constant Field Values
    • Constructor Detail

      • SMBClient

        public SMBClient()
      • SMBClient

        public SMBClient​(SmbConfig config)
    • Method Detail

      • connect

        public Connection connect​(java.lang.String hostname)
                           throws java.io.IOException
        Connect to the host at
        hostname
        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 at
        hostname
        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.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • getServerList

        public ServerList getServerList()