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

Connectivity fails randomly one of the IP mapped to the host name is In-correct /Not Active #661

Open
fazeem84 opened this issue Aug 17, 2021 · 4 comments

Comments

@fazeem84
Copy link

fazeem84 commented Aug 17, 2021

Hi @hierynomus and @pepijnve,
I am getting connection time out error randomly when I tried to connect share folder from My Java program.
When debugging the code found out that while for mapping host name to IP InetAddress.getAllByName("hostname") is been used and it returns two IP address one of which is not getting connected and the other one works fine
is there any way to try to connect the working IP if the other one fails to connect?

java.net.SocketTimeoutException: Connect timed out
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
at java.base/java.net.Socket.connect(Socket.java:648)
at com.hierynomus.protocol.commons.socket.ProxySocketFactory.createSocket(ProxySocketFactory.java:87)
at com.hierynomus.protocol.commons.socket.ProxySocketFactory.createSocket(ProxySocketFactory.java:63)
at com.hierynomus.smbj.transport.tcp.direct.DirectTcpTransport.connect(DirectTcpTransport.java:88)
at com.hierynomus.smbj.connection.Connection.connect(Connection.java:135)
at com.hierynomus.smbj.SMBClient.getEstablishedOrConnect(SMBClient.java:108)
at com.hierynomus.smbj.SMBClient.connect(SMBClient.java:79)

@fazeem84
Copy link
Author

Can Anybody look into the issue?

@rokkakasu
Copy link

rokkakasu commented Sep 6, 2021

Hi @fazeem84
I believe your hostname has 2 ip addresses (May be a load balancer or IP address is getting changed often(i.e Elastic IP))
your issue is similar to #644
Resolution

  1. Upgrade to SMBJ version 0.11.3
  2. do a try catch and remove the server from the SMBClient serverlist.
    Ex. smbclient.getServerList().unregister()
  3. Reconnect.

feel free to close this issue.

Thanks,
R Ramarajan.

@danielhasugian
Copy link

hi @rokkakasu

I follow your recommendation, but still failed.
Could you provide a snip code.

thanks

@hierynomus
Copy link
Owner

I've tried to address this in #835, please see whether that works better

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

4 participants