Edit: I tried copying the files but same result. After 20 files i run out of connections.
I am trying to use the jcsf-ng SMB lib to stream a number of small files from the windows share. But I am getting
After about 20 copies.
I am closing the connection after each on is finished:
Class Code:
Activity Code:
but I notice this comment on the close command for the SMBResource object.
but I can find no reference to setting a 'strict' mode.
Any help appreciated.
I am trying to use the jcsf-ng SMB lib to stream a number of small files from the windows share. But I am getting
B4X:
jcifs.smb.SmbException: No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
I am closing the connection after each on is finished:
Class Code:
B4X:
Sub Class_Globals
Public smbClient As SMBClient
Public glRes As SMBResource
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(cred As SMBCred)
smbClient.Initialize("SMBClient", cred.Domain, cred.Username, cred.Password, cred.Share)
End Sub
Sub SMBClient_CopyProgress(totalBytes As Long, path As String, filename As String)
Log($"SMBClient_CopyProgress(${totalBytes} : ${path}:${filename})"$)
End Sub
Sub SMBClient_Resource(success As Boolean, smbobjres As Object, smbobj As Object, info As String)
Log($"SMBClient_Resource(${success},${info},${smbobjres},${smbobj})"$)
If smbobjres <> Null And smbobj <> Null And info = "OK" Then
glRes = smbobjres
Dim InputStream1 As InputStream = glRes.openInputStream
Dim Bmp As Bitmap
Bmp.Initialize2(InputStream1)
CallSub2(actSMBFiles, "SetImg", Bmp)
InputStream1.Close
glRes.close
End If
End Sub
B4X:
Dim x As Int
Dim Copy As SMBCopyHERE
For x = 0 To lvFiles.Size - 1
Main.credentials.Share = lvFiles.GetItem(x).As(SMBFile).CanonicalPath
ToastMessageShow(lvFiles.GetItem(x).As(SMBFile).length, False)
' Main.credentials.Share = Value
Copy.Initialize(Main.credentials)
Sleep(30) 'allow the picture to display
Next
but I can find no reference to setting a 'strict' mode.
Any help appreciated.
Last edited: