Archived

This forum has been archived. Please start a new discussion on GitHub.

Ice/Android Ice.ConnectionRefusedException error=0

Hi,

I am facing a network issue with a simple ice-android app.
Here's the stacktrace:

07-01 16:17:25.720: WARN/System.err(733): [ 7/1/09 16:17:25:724 Network: trying to establish tcp connection to 127.0.0.1:10001 ]
07-01 16:17:25.790: WARN/System.err(733): [ 7/1/09 16:17:25:793 Network: failed to establish tcp connection
07-01 16:17:25.790: WARN/System.err(733): local address = 127.0.0.1:0
07-01 16:17:25.790: WARN/System.err(733): remote address = <not connected>
07-01 16:17:25.800: WARN/System.err(733): Ice.ConnectionRefusedException
07-01 16:17:25.800: WARN/System.err(733): error = 0 ]
07-01 16:17:25.810: WARN/System.err(733): [ 7/1/09 16:17:25:810 Network: shutting down tcp connection for reading and writing
07-01 16:17:25.810: WARN/System.err(733): local address = 127.0.0.1:0
07-01 16:17:25.810: WARN/System.err(733): remote address = <not connected> ]
07-01 16:17:26.050: DEBUG/dalvikvm(733): GC freed 4221 objects / 268240 bytes in 94ms
07-01 16:17:26.110: WARN/System.err(733): [ 7/1/09 16:17:26:109 Network: trying to establish tcp connection to 127.0.0.1:10001 ]
07-01 16:17:26.119: WARN/System.err(733): [ 7/1/09 16:17:26:121 Network: closing tcp connection
07-01 16:17:26.119: WARN/System.err(733): local address = 127.0.0.1:0
07-01 16:17:26.119: WARN/System.err(733): remote address = <not connected> ]
07-01 16:17:26.149: WARN/System.err(733): [ 7/1/09 16:17:26:151 Network: failed to establish tcp connection
07-01 16:17:26.169: WARN/System.err(733): local address = 127.0.0.1:0
07-01 16:17:26.169: WARN/System.err(733): remote address = <not connected>
07-01 16:17:26.169: WARN/System.err(733): Ice.ConnectionRefusedException
07-01 16:17:26.169: WARN/System.err(733): error = 0 ]
07-01 16:17:26.180: WARN/System.err(733): [ 7/1/09 16:17:26:179 Network: shutting down tcp connection for reading and writing
07-01 16:17:26.189: WARN/System.err(733): local address = 127.0.0.1:0
07-01 16:17:26.189: WARN/System.err(733): remote address = <not connected> ]
07-01 16:17:26.219: WARN/System.err(733): [ 7/1/09 16:17:26:224 Network: closing tcp connection
07-01 16:17:26.229: WARN/System.err(733): local address = 127.0.0.1:0
07-01 16:17:26.239: WARN/System.err(733): remote address = <not connected> ]
07-01 16:17:26.250: VERBOSE/ice(733): Ice.ConnectionRefusedException
07-01 16:17:26.250: VERBOSE/ice(733): error = 0
07-01 16:17:26.250: VERBOSE/ice(733): at IceInternal.Network.doConnect(Network.java:343)
07-01 16:17:26.250: VERBOSE/ice(733): at IceInternal.TcpTransceiver$1.run(TcpTransceiver.java:35)
07-01 16:17:26.250: VERBOSE/ice(733): at java.lang.Thread.run(Thread.java:1058)
07-01 16:17:26.250: VERBOSE/ice(733): Caused by: java.net.ConnectException: Connection refused
07-01 16:17:26.250: VERBOSE/ice(733): at org.apache.harmony.luni.platform.OSNetworkSystem.connectSocketImpl(Native Method)
07-01 16:17:26.250: VERBOSE/ice(733): at org.apache.harmony.luni.platform.OSNetworkSystem.connect(OSNetworkSystem.java:125)
07-01 16:17:26.250: VERBOSE/ice(733): at org.apache.harmony.nio.internal.SocketChannelImpl.connect(SocketChannelImpl.java:283)
07-01 16:17:26.250: VERBOSE/ice(733): at IceInternal.Network.doConnect(Network.java:331)
07-01 16:17:26.250: VERBOSE/ice(733): ... 2 more



Here're the other details

Communicator properties:
Ice.Trace.Network=2

Android 1.5/1.1
IceAndroid - 0.1.1
OS= Vista

Proxy String: testservice:tcp -h localhost -p 10001
Manifest:
<uses-permission android:name="android.permission.INTERNET"></uses-permission>

I can access the service through a servlet client (and also telnet).
So, the issue seems to be with the AndroidIce runtime.

I read a similar thread where the issue was traced to AndroidIce 0.1.0 and was resolved by patching three files, incl. IceInternal.TcpTransceiver mentioned in the stacktrace.
Since I am using 0.1.1, I presume that the issue lies elsewhere.

Any suggestions?

Thanks,
Gaurav.

Comments

  • mes
    mes California
    Hi,

    Welcome to the forum.

    The issue I described in this post also applies to version 0.1.1, but I don't think that's the problem in this case.

    It appears that your Android app is attempting to connect to an Ice server running on the device (or emulator). Is that correct? If so, is this server a separate application, or are the client and server components in the same app?

    Regards,
    Mark
  • Hi Mark,

    The Ice server is a separate component (a jar file) - which works fine with other clients.
    The issues comes into picture when I try to access it from the Android emulator.

    Also, I was earlier referring to this post

    Thanks,
    Gaurav.
  • mes
    mes California
    Hi,

    It's still not clear to me whether your Ice server is running on your host (the development machine) or in your emulator. Can you clarify that?

    If the server is running on your host, then you are using the wrong IP address. The emulator uses a virtual router, and the address of the host is 10.0.2.2. If you want an Android app running in the emulator to connect to a server running on the host, you need to use 10.0.2.2 and not the localhost address.

    Regards,
    Mark
  • I am running the the Ice Server on the development machine.
    But, the real issue, as you pointed out was the incorrect IP. I corrected it back to 10.0.2.2 to resolve it.

    Thanks for the help,
    Gaurav.