# 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="/pages/LwShShWOdjwgQLVtReAS#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="/pages/LwShShWOdjwgQLVtReAS#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](/container/usage/batch-and-stream-mode.md#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 %}


---

# Agent Instructions: 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:

```
GET https://doc.celantur.com/container/usage/tcp-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
