Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired #825

Open
atulluta8 opened this issue May 6, 2024 · 0 comments

Comments

@atulluta8
Copy link

atulluta8 commented May 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant