Open atulluta8 opened 3 months ago
com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired
I am trying to write a file to SMBJ Server aand I am getting the above error
I have used this to build the connection
SmbConfig config = SmbConfig.builder().withDfsEnabled(true).withTimeout(240L, TimeUnit.SECONDS).withSoTimeout(60L, TimeUnit.SECONDS).build(); SMBClient client = new SMBClient(config); Connection connection = client.connect(smbServer); AuthenticationContext authContext = new AuthenticationContext(username, password.toCharArray(), domain); Session session = connection.authenticate(authContext); DiskShare share = (DiskShare) session.connectShare("ShareName");
Set accessMask = new HashSet(EnumSet.of(AccessMask.FILE_ADD_FILE)); SMB2CreateDisposition createDisposition = SMB2CreateDisposition.FILE_CREATE; Set createOptions = new HashSet(EnumSet.of(SMB2CreateOptions.FILE_NON_DIRECTORY_FILE, SMB2CreateOptions.FILE_WRITE_THROUGH)); remoteFile = share.openFile(remoteFilePath, accessMask, null, SMB2ShareAccess.ALL, createDisposition, createOptions); long fileOffset=0; byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { remoteFile.write(buffer, fileOffset, 0, bytesRead); fileOffset+=bytesRead; } remoteFile.flush(); remoteFile.close();
I am using 0.10.0 version Jar File Libarary
Could you please help me identify what could be the cause of the issue
com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired
I am trying to write a file to SMBJ Server aand I am getting the above error
I have used this to build the connection
Set accessMask = new HashSet(EnumSet.of(AccessMask.FILE_ADD_FILE));
SMB2CreateDisposition createDisposition = SMB2CreateDisposition.FILE_CREATE;
Set createOptions = new HashSet(EnumSet.of(SMB2CreateOptions.FILE_NON_DIRECTORY_FILE, SMB2CreateOptions.FILE_WRITE_THROUGH));
remoteFile = share.openFile(remoteFilePath, accessMask, null, SMB2ShareAccess.ALL, createDisposition, createOptions);
long fileOffset=0;
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = is.read(buffer)) != -1) {
remoteFile.write(buffer, fileOffset, 0, bytesRead);
fileOffset+=bytesRead;
}
remoteFile.flush();
remoteFile.close();
I am using 0.10.0 version Jar File Libarary
Could you please help me identify what could be the cause of the issue