# Set up UDP server

When building IoT applications over NTN (satellite) networks, you need a server to send and receive data to and from your devices. Since NTN uses NB-IoT which only supports UDP, your server must be able to handle UDP packets.

Follow this guide to set up your own UDP server in minutes.

#### 1. Create a Server

Spin up a cloud server with a public IP address. For example using [Digital Ocean](https://www.digitalocean.com/).

{% hint style="info" %}
When using **Digital Ocean**:

* Create a new **Droplet** (starting at $4-6/month)
* Choose Ubuntu as the operating system
* Select the smallest size for testing
* Note down the **IP address** of your server
  {% endhint %}

#### 2. Install socat

SSH into your server and install <mark style="color:red;">`socat`</mark>, a versatile networking tool:

```bash
apt update
apt install socat -y
```

#### 3. Open the Firewall

Allow UDP traffic on port 9000:

```bash
ufw allow 9000/udp
```

#### 4. Start UDP Listener

Start a UDP listener on port 9000:

```bash
socat UDP4-RECVFROM:9000,fork -
```

{% hint style="info" %}
Explanation of the command:

* `UDP4-RECVFROM:9000` listens for UDP packets on port 9000
* `fork` handles multiple connections
* `-` outputs received data to the terminal
  {% endhint %}

#### 5. Test from your local machine

Before testing with your NTN device, verify the UDP server is working by sending data from your local machine:

```bash
socat - UDP:YOUR_SERVER_IP:9000
```

Type a message such as `hello world` and press Enter.

{% hint style="success" %}
Do you see the message appearing on your server terminal? Great work! The UDP server is working. ✅
{% endhint %}

### Next steps

Continue building your NTN application and start sending UDP data from your NTN-enabled devices. Have a look at our guides for the [**Murata Type 1SC**](/ntn-satellite-networks/udp-communication-for-ntn-applications/murata-type-1sc-send-receive-udp-data.md) or [**Nordic nRF9151 SiP**](/ntn-satellite-networks/udp-communication-for-ntn-applications/nordic-nrf9151-send-receive-udp-data.md).


---

# 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://docs.monogoto.io/ntn-satellite-networks/udp-communication-for-ntn-applications/set-up-udp-server.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.
