javaipv6smbjcifs

SmbException: A duplicate name exists on the network. for IPv6


The following code throws SmbException: A duplicate name exists on the network. at canRead()

String url = "smb://fe80--60ee-226a-4263-53d3s3.ipv6-literal.net/share/path"; SmbFile file = new SmbFile(url); file.canRead();

What's the reason?


Solution

  • We need to enclose the IPv6 address within square brackets. So if, for example, IPv6 address is fe80::60ee:226a:4263:53d3s3. Then the below code will work.

    String url = "smb://[fe80::60ee:226a:4263:53d3s3]/share/path";
    SmbFile file = new SmbFile(url);
    file.canRead();