Archived

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

Multicast problem

How do I send a message to several servers at the same time. I used multicast sample, however only one server receives the message.
And another question is how to make a server to send a response as a server generated message to the client.
Thank you.

Comments

  • xdm
    xdm La Coruña, Spain
    In the multicast demo, the client first sent a multicast request, that corresponds with the call to "lookup", all servers reply to this sending a proxy to a Hello object, and the client invokes the hello method in the first received proxy.

    So only the first "lookup" request is UDP multicast, other requests are TCP unicast.

    You can run client and servers with --Ice.Trace.Protocol=1 to trace protocol messages.
  • Re: Multicast problem

    Thank you for your reply. Here is another question: does ice provide any ways to make a true multicast working meaning a client sends a message that would be received by multiple servers, and then make servers to reply back?
  • xdm
    xdm La Coruña, Spain
    can you clarify what you want to do?

    In the demo the client sends a multicast message that is received by all the servers, and all the servers reply back to the client (as they want to reply just to the client that contacted then, the reply is an unicast message).
  • Thank you for your response.
    We are attempting to send a text from the client to all the servers.
    We implemented another method sayHelloName(String) in HelloI class.
    Then we execute that method in Client.java like this:
    hello.sayHelloName("Client says hello to the Server");

    Only one server receives it. We would like all servers to get it.
    Can you advise how to accomplish that?

    As the next step we would like all the servers to send another string back to the client in response.
  • xdm
    xdm La Coruña, Spain
    The server in the demo uses two separate object adapters:

    from config.sever
    #
    # The server creates a multi-cast object adapter with the name
    # "Discover". The following line sets the endpoints for this adapter.
    #
    Discover.Endpoints=udp -h 239.255.1.1 -p 10000
    
    #
    # The server creates an object adapter with the name "Hello". The
    # following line sets the endpoints for this adapter.
    #
    Hello.Endpoints=tcp
    

    HelloI servant is added to Hello object adapter, this adapter has just TCP endpoints.
    DiscoverI servant is added to Discover object adapter, this use a mulicast endpoint.

    You can only send multicast request to servants in the multicast adapter (Discover adapter). So add your method to DiscoverI and call it using the DiscoverPrx.
  • Hi,
    FYI, I added my own demo example for a basic multicast pub/sub :Multicast demo example

    Pleasure to share ;)