Archived

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

Multiple role of an executable with ICE simultaneously cliente and server on different interfaces

Can an executable play the role of a client from one side as, for example, being a hardware interface receiving data from it
and, from the other side, being a server (subscriber) from another interface collecting commands to be sent to the referred hardware? maybe with thread implementation in the same executable?
Thanks in advance for an answer.

Comments

  • mes
    mes California

    Hi,

    Yes, an Ice application can be both a client and a server simultaneously. For example, the "client" and "server" in our callback demo play both roles.

    Regards,
    Mark

  • Hi Mark,

    Thank you very much for your reply, I will analyse that example.

    Best regards,
    João

  • Hi,

    I read the examples carefully, but it looks that none of them corresponds to the architecture I am looking for which is the following in a simplified structure:
    a) 1 application with 3 executables e1,e2 and e3.
    b) executable e1 is a server with one ICE interface I1
    c) executable e2 is a client of the server e1 using the interface I1 and a server (subscriber) of the executable e2 (publisher) using the interface I2
    d) executable e3 is a client (publisher) of the server e2(subscriber) using the interface I2

    In this architecture, e2 is implemented with the application helper as subscriber of interface I2 and a thread to implement the client side of the interface I1.

    I am using icegrid for the manage the connection between e1 and e2 and icebox the manage the icestorm that publishes and subscribes the datasorts of the interface I2.

    In order to test this architecture in a simplified way, all the executables running in the same host.

    Nevertheless I cannot have a connection, up to now, resulting the following exceptions:
    "
    base:adapter -t -e 1.1:tcp -p 4061 -t 60000
    Outgoing.cpp:478: Ice::ObjectNotExistException:
    object does not exist:
    identity: adapter' facet: operation: ice_isA ==> inside the exception ex... ==> first time registering the adapter not succeeded... error: Reference.cpp:1676: Ice::NoEndpointException: no suitable endpoint available for proxyDSCIceGrid/Query -t -e 1.1'

    Can you please help me?

    Best regards,
    João

  • mes
    mes California

    Are you using IceGrid to deploy your application and start servers automatically? Or are you starting your servers manually?

    If you're starting them manually, did you configure the Ice.Default.Locator property?

    If you're still having trouble, please provide as much information as you can about your configuration settings. We'd prefer to see a complete example with all configuration files, source code, etc.

    Regards,
    Mark

  • Hello Mark,

    Thank you for you reply.
    In attachment you find the project stub with 4 directories. One of them (make) contains the general rules of the makefile (just like the demos supplied by zeroc) and the remaining 3 directories contains the source code to generate the executables, where each of them has a Makefile available to compile the c++ files in a linux environment.
    The executable in DSC_MODEM_Server directory needs a serial USB to be available for serial line communication. This executable reads and writes data to a serial line (/dev/ttyUSB0) and makes it available to the executable DSC_Facilities (client from DSC_MODEM_Server and consumer of commands from DSC_HMI).
    The executable DSC_HMI (publisher of commands) is the interface with the operator that gives commands to send messages through the DSC_Facilities to the serial line controlled by DSC_MODEM_Server.
    The respective config files are specified in each of the 3 executable directories.
    .

  • The servers are executed on demand and I think that the Ice.Default.Locator is correctly defined. But, in fact something I defined wrong because it does not work.

    best regards,
    João

  • Hi Mark,

    I found the mistake I had in the code. In fact the Ice.Default.Locator was not initialized in one of the interfaces that is implemented in the thread that was controlling the client part, which is not using the Application helper. As,I know now how to initialize the communicator without the helper,I solved the problem.
    Thank you for your tip about the Locator.

    Best regards,
    Joao

  • mes
    mes California

    Glad you found the problem.

    Take care,
    Mark