Search code examples
javaandroidsambasmbjcifs

How do you list all smb servers on the network?


Is it possible using jcifs to list all smb servers available on the network? I tried a suggestion on another post of passing smb:// to the SmbFile constructor but that didn't give me any results. Whereas I am able to pass smb://username:password@machinename and that works fine. Other computers are able to find machinename without problems and even another Android app is able to see it using SMB.


Solution

  • The list of servers is not available through the SMB protocol itself. To receive such a list the client must implement LSA and SAMR protocols. Both are DCERPC pipes. JCIFS features a generic DCERPC framework but, as far as I know, it does not implement the required LSA and SAMR. Alternative SMB clients: smbclient, NQE and jNQ do implement these calls.