# TCP mode

You can run Celantur Container in TCP mode. This allows you to send and receive images (in JPEG format or as NumPy array) over a TCP socket connection, resulting in performance gains by reducing read/write and data conversion overhead.

{% hint style="info" %}
Not yet supported in TCP mode&#x20;

* Anonymization of video files
* Generation of metadata JSON files
  {% endhint %}

### Parameters

<table><thead><tr><th width="374">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>--server &#x3C;host:port></code></td><td><a href="#transfer-images-as-jpeg">TCP mode for JPEG image transfer.</a></td></tr><tr><td><code>--server-array &#x3C;host:port></code></td><td><a href="#transfer-images-as-numpy-arrays">TCP mode for NumPy array transfer.</a></td></tr></tbody></table>

## Transfer images as JPEG&#x20;

Transfer images in JPEG format over a TCP connection by using

{% code title="Blur faces/license plates" %}

```sh
bash celantur.sh --server 0.0.0.0:9999 -a face -a license-plate --format whole
```

{% endcode %}

Find a Python implementation of the **client script** here:

{% embed url="<https://github.com/celantur/celantur-examples/blob/main/server/celantur-jpeg-client.py>" %}
Implementation
{% endembed %}

## Transfer images as NumPy arrays

Transfer images as NumPy arrays over a TCP connection by using

```
bash celantur.sh --server-array 0.0.0.0:9999 -a face -a license-plate --format whole
```

Add `save-mask binary --mask-scale 20` as [parameters](https://doc.celantur.com/container/batch-and-stream-mode#parameters) to receive segmentation masks instead of an anonymized image. The received binary mask has to be saved as PNG.

{% code title="Get binary masks" overflow="wrap" %}

```sh
bash celantur.sh --server-array 0.0.0.0:9999 -a face -a license-plate --format whole --save-mask binary --mask-scale 20
```

{% endcode %}

Find a Python implementation of the **client script** here:

{% embed url="<https://github.com/celantur/celantur-examples/blob/main/server/celantur-numpy-client.py>" %}
Implementation
{% endembed %}

## FAQ

### I'm transferring data over a VPN, does that work?

Yes, transferring data via TCP mode over a VPN works.&#x20;

{% hint style="warning" %}
The **maximum TCP frame size** has to be lower than the one specified for your VPN, to avoid issues during data transfer.
{% endhint %}
