Hello:
I have to write an interface which is IP and port limited from the source for security reasons. I'm having a problem opening a socket using local values.
new Socket(sHostAddr, nHostPort, InetAddress.getByName("127.0.0.1"), 1030);
causes
java.net.SocketException: Network is unreachable
at java.net.PlainSocketImpl.socketConnect(PlainSocket Impl.java:-2)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.j ava:432)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:249)
at ts.sswitch.s.fcic.FCICConn.openSocket(FCICConn.jav a:569)
at ts.portal.SingletonConn.transmitterLoop(SingletonC onn.java:202)
at ts.sswitch.s.fcic.FCICConn$1.run(FCICConn.java:155 )
at java.lang.Thread.run(Thread.java:680)
Changing the local values
new Socket(sHostAddr, nHostPort, InetAddress.getByName("localhost"), 12000);
doesn't help. But removing the local values does.
new Socket(sHostAddr, nHostPort);
Unfortunately, I'm going to need these values. I had this working years ago on Java 5 on the PC. I'm trying now with Java 6 on Mac OS X 10.6.8. Thanks in advance for any help.
Dan