    

 ## On this page

  

 

 # server:grpc start server

 Last update: 31.07.2026 

**Version: 0.0.0**

## Description

Starts a dpf's grpc server (if local) or connect to one and keep it waiting for requests in a streams.

## Inputs

This table lists the input pins for this operator. Input pins define the data that the operator requires to perform its operation. Some inputs are required, while others are optional and provide additional configuration. Each parameter is detailed in the sections that follow the table.

Pin numberNameStatusExpected type(s)0[ip](#input_0)[`string`](../../core-concepts/dpf-types.md#standard-types)**1**[port](#input_1)[`string`](../../core-concepts/dpf-types.md#standard-types), [`int32`](../../core-concepts/dpf-types.md#standard-types)**2**[starting\_option](#input_2)[`int32`](../../core-concepts/dpf-types.md#standard-types)**3**[should\_start\_server](#input_3)[`bool`](../../core-concepts/dpf-types.md#standard-types)**4**[data\_sources](#input_4)[`data_sources`](../../core-concepts/dpf-types.md#data-sources)**5**[dpf\_context](#input_5)[`string`](../../core-concepts/dpf-types.md#standard-types), [`int32`](../../core-concepts/dpf-types.md#standard-types)**6**[transport\_mode](#input_6)[`int32`](../../core-concepts/dpf-types.md#standard-types)**7**[tls\_certificates\_dir](#input_7)[`string`](../../core-concepts/dpf-types.md#standard-types)<a id="input_0"></a>

### ip (Pin 0)

- **Required:** No
- **Expected type(s):** [`string`](../../core-concepts/dpf-types.md#standard-types)

If no ip address is put, the local ip address is taken

<a id="input_1"></a>

### port (Pin 1)

- **Required:** No
- **Expected type(s):** [`string`](../../core-concepts/dpf-types.md#standard-types), [`int32`](../../core-concepts/dpf-types.md#standard-types)

If no port is put, port 50052 is taken

<a id="input_2"></a>

### starting\_option (Pin 2)

- **Required:** No
- **Expected type(s):** [`int32`](../../core-concepts/dpf-types.md#standard-types)

default is 1 that starts server in new thread. With 0, this thread will be waiting for grpc calls and will not be usable for anything else. With 2, it the server will be started in a new process.

<a id="input_3"></a>

### should\_start\_server (Pin 3)

- **Required:** No
- **Expected type(s):** [`bool`](../../core-concepts/dpf-types.md#standard-types)

If true, the server is assumed to be local and is started. If false, only a client (able to send grpc calls) will be started

<a id="input_4"></a>

### data\_sources (Pin 4)

- **Required:** No
- **Expected type(s):** [`data_sources`](../../core-concepts/dpf-types.md#data-sources)

A data source with result key 'grpc' and file path 'port:ip' can be used instead of the input port and IP.

<a id="input_5"></a>

### dpf\_context (Pin 5)

- **Required:** No
- **Expected type(s):** [`string`](../../core-concepts/dpf-types.md#standard-types), [`int32`](../../core-concepts/dpf-types.md#standard-types)

This pin is associated with pin(2) = 2 (server started in a new process). User can enter the integer associated with a DPF context (1: Standalone Context - DpfCoreStandalone.xml, 3: Custom - DpfCustomDefined.xml) or a string with the path of the XML specifying the context.

<a id="input_6"></a>

### transport\_mode (Pin 6)

- **Required:** No
- **Expected type(s):** [`int32`](../../core-concepts/dpf-types.md#standard-types)

Transport Mode.

- 0: Insecure (default, localhost as default)
- 1: Insecure Legacy (Legacy logic to find non localhost interface)\* 2: mTLS (ANSYS\_GRPC\_CERTIFICATES must point on certificates folder, containing server.crt, server.key and ca.crt)

<a id="input_7"></a>

### tls\_certificates\_dir (Pin 7)

- **Required:** No
- **Expected type(s):** [`string`](../../core-concepts/dpf-types.md#standard-types)

Path to certificates directory when mTLS mode is enabled.

## Outputs

This table lists the output pins for this operator. Output pins provide the results of the operator's computation and can be connected to inputs of other operators or retrieved for further processing. Each output is detailed in the sections that follow the table.

Pin numberNameExpected type(s)0[grpc\_streams](#output_0)[`streams_container`](../../core-concepts/dpf-types.md#streams-container)<a id="output_0"></a>

### grpc\_streams (Pin 0)

- **Expected type(s):** [`streams_container`](../../core-concepts/dpf-types.md#streams-container)

dpf streams handling the server, if the server is started in this thread, then nothing is added in output

## Configurations

This operator supports [configuration options](../../core-concepts/operator-configurations.md) that modify its behavior.

### [mutex](../../core-concepts/operator-configurations.md#mutex)

- **Expected type(s):** [`bool`](../../core-concepts/dpf-types.md#standard-types)
- **Default value:** false

If this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads.

## Scripting

This operator can be accessed through scripting interfaces using these identifiers.

**Category**: server

**Plugin**: grpc

**Scripting name**: grpc\_start\_server

**Full name**: server.grpc\_start\_server

**Internal name**: grpc::stream\_provider

**License**: None

## Examples

These examples demonstrate how to use this operator in different programming environments. Each example shows how to instantiate the operator, connect the required inputs, and retrieve the output.

C++```cpp
#include "dpf_api.h"

ansys::dpf::Operator op("grpc::stream_provider"); // operator instantiation
op.connect(0, my_ip);
op.connect(1, my_port);
op.connect(2, my_starting_option);
op.connect(3, my_should_start_server);
op.connect(4, my_data_sources);
op.connect(5, my_dpf_context);
op.connect(6, my_transport_mode);
op.connect(7, my_tls_certificates_dir);
ansys::dpf::Streams my_grpc_streams = op.getOutput<ansys::dpf::Streams>(0);

```

CPython```python
import ansys.dpf.core as dpf

op = dpf.operators.server.grpc_start_server() # operator instantiation
op.inputs.ip.connect(my_ip)
op.inputs.port.connect(my_port)
op.inputs.starting_option.connect(my_starting_option)
op.inputs.should_start_server.connect(my_should_start_server)
op.inputs.data_sources.connect(my_data_sources)
op.inputs.dpf_context.connect(my_dpf_context)
op.inputs.transport_mode.connect(my_transport_mode)
op.inputs.tls_certificates_dir.connect(my_tls_certificates_dir)
my_grpc_streams = op.outputs.grpc_streams()

```

IPython```python
import mech_dpf
import Ans.DataProcessing as dpf

op = dpf.operators.server.grpc_start_server() # operator instantiation
op.inputs.ip.Connect(my_ip)
op.inputs.port.Connect(my_port)
op.inputs.starting_option.Connect(my_starting_option)
op.inputs.should_start_server.Connect(my_should_start_server)
op.inputs.data_sources.Connect(my_data_sources)
op.inputs.dpf_context.Connect(my_dpf_context)
op.inputs.transport_mode.Connect(my_transport_mode)
op.inputs.tls_certificates_dir.Connect(my_tls_certificates_dir)
my_grpc_streams = op.outputs.grpc_streams.GetData()

```

  
## Changelog

- Version 0.0.0: Initial release.