When can I get the "java.net.SocketException: Permission denied:connect" message? And how can it be avoided?

Question ID : 197
Created on 2013-02-14 at 10:53 AM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=197

The "java.net.SocketException: Permission denied: connect" exception message may happen when you are working in Application Server or with a client/server environment via VPN connection and you are using Java 7.

The reason is that isCOBOL uses the IPv4 type of sockets and Java 7 brings support for IPv6 sockets on Windows.
So, when you attempt to connect to an IPv4 address then "behind the scenes" it will use an IPv4-mapped IPv6 address.
And if the VPN product doesn't support the IPv6 sockets this exception will happen.

For example, if you want to connect via thin-client and you use any of the following commands:

iscclient -hostname host -port port progname
java com.iscobol.gui.client.Client -hostname host -port port progname

Or if you want to access the Veryant UDBC server started on the server machine and you run the command:

visql -cstring jdbc:veryant:udbc-server-ip:udbc-server-port:database -u user
To solve this problem you have to use the java property java.net.preferIPv4Stack=true
iscclient -J-Djava.net.preferIPv4Stack=true com.iscobol.gui.client.Client -hostname MAIN_PROGR
java -Djava.net.preferIPv4Stack=true com.iscobol.gui.client.Client -hostname MAIN_PROGR
visql -J-Djava.net.preferIPv4Stack=true -cstring jdbc:veryant: -u admin

Back to Original Question