IPC server/client


#1

I have created two applications and each has a component. At the moment I use one application as a server and the other as a client.

I might need communication in both directions so I have tried to create an application that is both a client and server. Meaning that the cdef file has both provides and requires section. Adef file has both bindings and provides section. But this fails for me. The application does not start properly, I don’t even get to the COMPONENT_INIT.

Is it supposed to be possible to do this or is there a better way to send data in both directions?


#2

Just realised that it is possible to return a value from the server back to the client. At least that will be enough for me. You have to define in the *.api file that something should be reurned. If you don’t specify anything it is void.

FUNCTION SetCommand
(
    string message[100] IN 
);
FUNCTION int SetTemp
(
    double message IN 
);

#3

Hiya,

I managed to get a multi threaded application running that used shared memory to communicate between threads.

However, this was using the posix shm interface, not via the Legato api.

Ciao, Dave


#4

You can also specify that a parameter is an OUT parameter to get info back from the server. For example:

FUNCTION int SetTemp
(
    double message IN, 
    double result OUT
);

#5

…And you can use also create call-backs from the server to the client (although, to prevent deadlocks, those can’t return anything to the server).