> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/annotated/class_ipc_server.md).

# IpcServer

[Public Member Functions](#pub-methods)

`#include <`[ipcserver.h](/s-adk-5.1-programmers-guide/ipcserver_8h_source.md)`>`

|                         |                                                                                                                                                                                                 |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Public Member Functions |                                                                                                                                                                                                 |
|                         | [IpcServer](#a7477d0bb89e2b8aaa285f8e6525c2051) ()                                                                                                                                              |
|                         | [\~IpcServer](#a1e1016d19546b3ce68a09a5a9e25b26a) ()                                                                                                                                            |
| void                    | [set](#a6c71e45e9e2b98bd37d658e079cf45e4) ([vfiipc::IPC](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.1_staging/classvfiipc_1_1_i_p_c.md) \*ipc)                              |
| bool                    | [run](#a531e20ac2de740026b25f32dd70b16e4) ([vfiipc::IPC](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.1_staging/classvfiipc_1_1_i_p_c.md) \*ipc, const Service \&init\_value) |
| bool                    | [stop](#ad6c437bd29e6b2ba430750e6d3322055) (void)                                                                                                                                               |

### DetailedDescription <a href="#detailed-description" id="detailed-description"></a>

#### template\<classService>

class IpcServer< Service >

template class for creating a IPC server interface

**Parameters**

\[in] **Service** Class containing the service that is run on the server. This class must provide the following features:It must have been derived from class Thread so that processing can be started as separate thread.It must have a copy constructor.It must have a method setIO(IPC \*io) that accepts a pointer to an IPC object. This object is used for receiving / sending data from / to the network.It must have a method bool failure(IPC \*io) const that is invoked in case of IPC::accept() returns with an error. The listen IPC object is passed to this function. Function failure() recover the listen IPC object (if required). Function failure() returns true, the server will continue, otherwise with false function run() will return.The destructor must delete the IPC object passed on to setIO().

### Constructor& Destructor Documentation

### IpcServer() <a href="#a7477d0bb89e2b8aaa285f8e6525c2051" id="a7477d0bb89e2b8aaa285f8e6525c2051"></a>

[IpcServer](/s-adk-5.1-programmers-guide/readme/annotated/class_ipc_server.md)

inline

Set up a server that accepts connections on IPC object.

{% hint style="info" %}
[IpcServer](/s-adk-5.1-programmers-guide/readme/annotated/class_ipc_server.md) object overtakes ownership and frees the IPC instance in destructor
{% endhint %}

### \~IpcServer() <a href="#a1e1016d19546b3ce68a09a5a9e25b26a" id="a1e1016d19546b3ce68a09a5a9e25b26a"></a>

\\\~[IpcServer](/s-adk-5.1-programmers-guide/readme/annotated/class_ipc_server.md)

inline

### MemberFunction Documentation <a href="#member-function-documentation" id="member-function-documentation"></a>

### run() <a href="#a531e20ac2de740026b25f32dd70b16e4" id="a531e20ac2de740026b25f32dd70b16e4"></a>

bool run

Run the server synchronously, therefore, the function will block as long as the server is running and not stopped.

**Parameters**

\[in] **ipc** IPC server object (must be valid as long as server is running). If set() with an IPC object was already invoked, this parameter is ignored. \[in] **init\_value** initialization value for the objects created to handle server requests.

#### Returns

false if starting the server failed. true if the server was successfully started and aborted by [stop()](#ad6c437bd29e6b2ba430750e6d3322055) function. After the function has returned, the caller is again responsible for the IPC object. Finally, [set()](#a6c71e45e9e2b98bd37d658e079cf45e4) and [run()](#a531e20ac2de740026b25f32dd70b16e4) can be call with another IPC object.

### set() <a href="#a6c71e45e9e2b98bd37d658e079cf45e4" id="a6c71e45e9e2b98bd37d658e079cf45e4"></a>

void set

inline

set IPC object to use for [run()](#a531e20ac2de740026b25f32dd70b16e4) and [stop()](#ad6c437bd29e6b2ba430750e6d3322055) afterwards

**Parameters**

\[in] **ipc** IPC server object (must be valid as long as server is running)

### stop() <a href="#ad6c437bd29e6b2ba430750e6d3322055" id="ad6c437bd29e6b2ba430750e6d3322055"></a>

bool stop

Stop the server accepting new connections

***

The documentation for this class was generated from the following file:

* sdi/src/[ipcserver.h](/s-adk-5.1-programmers-guide/ipcserver_8h_source.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/annotated/class_ipc_server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
