Archived

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

Client with VMWare publishes multiple IP addresses when using callbacks

My first question here, so apologies for any newbie mistakes.

I have an application that uses the simple (not AMI) callback mechanism. The client registers a callback handler with the server in order to receive asynchronous updates.

My issue is that if my client runs on a machine with VWMare Workstation installed, it publishes multiple IP addresses to the server when registering the callback. It sends the real NIC's IP as well as the private subnet virtual IP addresses assigned by VMWare.

So I get intermittent failures. When the server calls back on the real IP address it works. But if it picks one of the virtual NICs' addresses it fails.

I think I need a way of telling the server to only use the hardware NIC when registering the callback handler. How do I do that? Or have I misunderstood what is going on here?

It it makes any difference, the client is .net, the server is java, and we're using Ice 3.2.1.

Comments

  • xdm
    xdm La Coruña, Spain
    Hi Sergio,

    You need to configure the adapter endpoints to feet your needs

    For example in your config file
    MyAdapter.Endpoints=tcp ‑h 10.0.1.1 ‑p 9999
    

    This is documented in manual
    http://www.zeroc.com/doc/Ice-3.3.0-IceTouch/manual/Adv_server.33.4.html

    See 32.4.6 Endpoints section

    Regards,
    José
  • xdm
    xdm La Coruña, Spain
    You could be also interested in Published Endpoints documented in the same section. This could be useful if you still wanted to listen on all interfaces but only publish the external (non VM) ip

    As an example, the properties below configure the adapter named MyAdapter with physical and published endpoints:
    MyAdapter.Endpoints=tcp ‑h 10.0.1.1 ‑p 9999
    MyAdapter.PublishedEndpoints=tcp ‑h corpfw ‑p 25000
    
    This example assumes that clients connecting to host corpfw at port 25000 are forwarded to the adapter’s endpoint in the private network.
  • Thanks very much for the prompt replies. Sorry, I am defeintly missing something here. I had read that chapter and can't follow how to apply it in my scenario.

    I use the server's hostname from the client when creating the object adaptor and proxy for the service that I want to call:
    i.e.

    ObjectPrx objectProxy = communicator.stringToProxy("myserver:tcp -h my.server.hostname -p 12345");
    ObjectAdapter objectAdaptor = communicator.createObjectAdapterWithEndpoints("adapter.name", "tcp");
    objectAdaptor.activate();
    myServiceProxy = MyServicePrxHelper.checkedCast(objectProxy);


    Which works fine - I can make requests to the server at that host and port with no problems.

    However, one of the functions the client calls uses a callback handler. I create the handler using:

    UpdateListenerpPrx updateListenerProxy = UpdateListenerPrxHelper.uncheckedCast(objectAdaptor.addWithUUID(updateListener));


    On a client with multiple network interfaces, the server cannot seem to call back to the client.

    I am sure I am doing something stupid when creating the update listener, but can't quite see how to rectify it. Can I change the way I create the callback handler so that I can use my client's hostname? Or tell the server to only use the publically accessible IP address? Any help would be much appreciated.
  • Just to make sure that I understand correctly...

    The client makes an invocation to an object in the server (which works), and the server calls back into the client via a proxy passed by the client, which fails?

    In that case, if the client has several interfaces, only some of which are accessible to the server, the client must publish the accessible endpoints in the proxy. The client can do this by setting the <adapter-name>.Endpoints property, or by using createAdapterWithEndpoints to create the adapter. (Use the -h <hostname> option to specify the correct interface.)

    Of course, the server must be allowed to open a connection to the client. If a firewall prevents the server from connecting to the client for the callback, you must use a bidirectional connection.

    To debug things, you can set Ice.Trace.Network=2 for the server. That will show you what connection attempts are made.

    Cheers,

    Michi.
  • xdm
    xdm La Coruña, Spain
    Hi Sergio
    ObjectPrx objectProxy = communicator.stringToProxy("myserver:tcp -h my.server.hostname -p 12345");

    Here you create a proxy that points to my.server.hostname so there is not problem.
    ObjectAdapter objectAdaptor = communicator.createObjectAdapterWithEndpoints("ada pter.name", "tcp");

    Here yo create an adapter with endpoints but you don't use -h option so it will use 0.0.0.0 as default

    If you want this adapter listen only on one specific host you should do something like
    ObjectAdapter objectAdaptor = communicator.createObjectAdapterWithEndpoints("MyAdapter", 
                                                                       "tcp -h hostname");
    

    or you could configure it in a configuration file
    MyAdapter.Endpoints=tpc -h hostname
    
    and create the adapter with the following code
    ObjectAdapter objectAdaptor = communicator.createObjectAdapterWithEndpoints("MyAdapter");
    

    To diagnose connections problems is always useful set Ice.Trace.Network=1 or (2, 3) and you could see what ip is trying to connect the server when it fails.

    Let us know if you need further help to getting this working

    Regards,
    José