# IPC server/client

**URL:** https://forum.legato.io/t/ipc-server-client/91
**Category:** Legato Application Framework
**Created:** [December 17, 2014, 2:19pm UTC](https://forum.legato.io/t/ipc-server-client/91 "2014-12-17T14:19:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![krima919](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@krima919](https://forum.legato.io/u/krima919)
#### Post date: [December 17, 2014, 2:19pm UTC](https://forum.legato.io/t/ipc-server-client/91/1 "2014-12-17T14:19:45Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![krima919](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@krima919](https://forum.legato.io/u/krima919)
#### Post date: [December 17, 2014, 2:44pm UTC](https://forum.legato.io/t/ipc-server-client/91/2 "2014-12-17T14:44:41Z")

</div>

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.

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

---

<div class="post-metadata">

### Author: ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.legato.io/u/davidc)
#### Post date: [December 19, 2014, 9:23am UTC](https://forum.legato.io/t/ipc-server-client/91/3 "2014-12-19T09:23:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zblazek](https://avatars.discourse-cdn.com/v4/letter/z/a9adbd/32.png) [@zblazek](https://forum.legato.io/u/zblazek)
#### Post date: [December 24, 2014, 6:49pm UTC](https://forum.legato.io/t/ipc-server-client/91/4 "2014-12-24T18:49:22Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![jchitty](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jchitty/32/72_2.png) [@jchitty](https://forum.legato.io/u/jchitty)
#### Post date: [January 6, 2015, 12:33am UTC](https://forum.legato.io/t/ipc-server-client/91/5 "2015-01-06T00:33:58Z")

</div>

…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).
