zeroc-ice / ice-demos

Sample programs for Ice
https://zeroc.com
GNU General Public License v2.0
325 stars 217 forks source link

Java/android/hello #133

Closed ZiRaymondal closed 3 years ago

ZiRaymondal commented 3 years ago

Hello !

I'm not able to connect https://github.com/zeroc-ice/ice-demos/blob/3.7/java/android/hello/src/main/java/com/zeroc/hello/HelloApp.java with the hello cpp11 demo. I tried to change tcp port on 10004 on the android demo to match server.config but it still not working.

It works with Ice Discovery tho...

pepone commented 3 years ago

are you running the android demo from the simulator, what IP address is the server listening on?

ZiRaymondal commented 3 years ago

Ok I fixed it : I need to setup the tcp port to 45049 ( line 392 of the last link), I found this port number with the start message of the cpp client ( endpoint line, first port i've seen lol ). Can you explain me why plz ? I'm kinda lost ( I'm not working directly on the demo but I'm doing a Univ project wich starts from it ). Thanks for your reactivity btw

I'm running the demo on my current cellphone, the server seems to listen on 192.168.1.5:10004 ( that's what I understand from the serverconfig file of the cpp11 IceDiscovery/hello server & my ifconfig command ofc )

pepone commented 3 years ago

By default the server listens on tcp 10000, ssl 10001, ws 10002, and wss 10003 https://github.com/zeroc-ice/ice-demos/blob/7a91b5461d8358753e766bd1b12cd505d1f093f1/cpp11/Ice/hello/config.server#L11

port 10004 is used for Admin object if enabled https://github.com/zeroc-ice/ice-demos/blob/7a91b5461d8358753e766bd1b12cd505d1f093f1/cpp11/Ice/hello/config.server#L71

The simpler to check what address the server listens on, is to enable network tracing in the config https://github.com/zeroc-ice/ice-demos/blob/7a91b5461d8358753e766bd1b12cd505d1f093f1/cpp11/Ice/hello/config.server#L39

ZiRaymondal commented 3 years ago

config.txt

I've started from the IceDiscovery/hello server not /Ice/hello, so I have this config.file ( not edited ). It doesn't work by default with the tcp port set at 10000.

So i've just edited the admin port by mistake, but it I don't understand why I need to change tcp port from 10000 to the magic number 45049 on my android client.

Android Client line 39X : is not working with the IceDiscovery/hello server else s = "hello:tcp -h " + _host + " -p 10000:ssl -h " + _host + " -p 10001:udp -h " + _host + " -p 10000"; But it works with tcp set to 45049

pepone commented 3 years ago

This demo works with the 2 servers to show different use cases:

see https://doc.zeroc.com/ice/3.7/ice-plugins/icediscovery

This is mention in the Android hello README https://github.com/zeroc-ice/ice-demos/tree/3.7/java/android/hello

ZiRaymondal commented 3 years ago

Yep so ok I've missed that so far x'). Is there a way to print the Endpoint port once the Discovery server launched ? I saw the client displays it but can't find how to do so server side.

Anyway thank u very much my IceLord for your time !

pepone commented 3 years ago

If you set Ice.Trace.Network=3 in the server config file, you should see the address the server binds

https://doc.zeroc.com/ice/3.7/property-reference/ice-trace#id-.Ice.Trace.*v3.7-Ice.Trace.Network

ZiRaymondal commented 3 years ago

Thx very muchhhhh mann, you are so nice, have a nice day !