I was wondering in what other circumstances this (SocketException: Permission denied: connect) error would be thrown from the line
SocketAddress socketAddress = new InetSocketAddress("86.143.5.165", 6464);
// Set a 3s timeout
clientSocket.connect(socketAddress, 3000);
There are a few Android issues relating to permissions, and when using a port < 1024. I am running a simple java client/server app, on port 6464, and i am using java 1.6.0_32 (after reading that Java 1.7.0_7 adds ipv6 support).
I have port 80 forwarded to my server (verified on the client machine by going to my external IP in a browser), and the port 6464 is open also.
Why would the client be refused connection?
EDIT: I did originally get this error when trying to connect to the server from the server itself. (Obviously, I guess it's like a telephone in that you get an engaged tone). I had a friend test it, and he could connect. I'm now connecting from a laptop that isn't on the LAN (i.e. using a 3g mobile as a hotspot), but strangely still getting the error.
EDIT2:
java.net.SocketException: Permission denied: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at runtime.MyGame.main(MyGame.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
#### Java Web Start Error:
#### Socket failed to connect
The client isn't being 'refused connection'. It is being refused permission to connect, by the local operating system.
IPv6 support was added in Java 1.4.