# Murata Type 1SC: Send/Receive UDP Data

Start sending data to a UDP server, and from the server back to the device. For more information about getting started with the Murata Type 1SC, visit [this guide](/ntn-satellite-networks/ntn-certified-devices/ntn-certified-modules/murata-lbad0xx1sc-dm-satellite-ntn-network.md).

***

#### 1. Send data from your device

**Open a UDP Socket**

Replace <mark style="color:red;">`YOUR_SERVER_IP`</mark> and <mark style="color:red;">`PORT`</mark> with your server's ip address and port.

```
AT%SOCKETCMD="ALLOCATE",1,"UDP","OPEN","YOUR_SERVER_IP",PORT
```

Expected Response: `SOCKETCMD: 1`

**Set Socket Options and Activate the socket**

```
AT%SOCKETCMD="SETOPT",1,36000,1
AT%SOCKETCMD="ACTIVATE",1
```

Expected Response: <mark style="color:red;">`OK`</mark>

**Send UDP Payload**

Send the message <mark style="color:red;">`Hello World`</mark> encoded to hex using [RapidTables](https://www.rapidtables.com/convert/number/ascii-to-hex.html): <mark style="color:red;">`48656C6C6F20576F726C64`</mark>:

```
AT%SOCKETDATA="SEND",1,11,"48656C6C6F20576F726C64"
```

Expected Response: <mark style="color:red;">`%SOCKETDATA: 1,11`</mark>

{% hint style="info" %}
The payload: "Hello World" is 11 bytes in size. If you're sending a different payload, make sure to count the exact number of characters you send.
{% endhint %}

**Close the Socket**

```
AT%SOCKETCMD="DELETE",1
```

Expected Response: <mark style="color:red;">`OK`</mark>

On your server terminal, you should see:

```
Hello World
```

{% hint style="success" %}
Is the uplink working? Nice! Let's continue with bidirectional communication
{% endhint %}

***

#### 2. Enable Downlink (Server → Device)

The SIM by default doesn't have a public IP address, hence can only send a downlink **immediately after receiving an uplink**, before the socket clses. The server responds using the same IP address and port from which the data was received.

To test this, you'll need a UDP server that sends a response. You can use <mark style="color:red;">`socat`</mark> with a script that logs incoming data sent to port <mark style="color:red;">`9000`</mark> and sends "**ACK**" as a response:

```bash
socat UDP4-RECVFROM:9000,fork SYSTEM:'tee /dev/stderr > /dev/null; echo ack'
```

***

#### 3. Test Bidirectional Communication

On your device, send data and wait for a response.

**Start by opening the UDP port and send data to your UDP server:**

Change <mark style="color:red;">`YOUR_SERVER_IP`</mark> with your server's IP address.

```
AT%SOCKETCMD="ALLOCATE",1,"UDP","OPEN","YOUR_SERVER_IP",9000
AT%SOCKETCMD="SETOPT",1,36000,1
AT%SOCKETCMD="ACTIVATE",1
AT%SOCKETDATA="SEND",1,11,"48656C6C6F20576F726C64"
```

The response <mark style="color:red;">`%SOCKETEV: 1,1`</mark> (not <mark style="color:red;">`%SOCKETCMD: 1`</mark> ) indicates that a packet was received.

**Read incoming UDP data**

```
AT%SOCKETDATA="RECEIVE",1,1500
```

Example Response: <mark style="color:red;">`%SOCKETDATA: 1,1,1,"61636B0A","Sender_IP",PORT`</mark>

{% hint style="info" %}
The hex string <mark style="color:red;">`61636B0A`</mark> decodes to <mark style="color:red;">`ack`</mark>)
{% endhint %}

**Close the Listener Socket**

```
AT%SOCKETCMD="DELETE",1
```

Expected Response: <mark style="color:red;">`OK`</mark>&#x20;

{% hint style="success" %}
Do you see the data appearing in the server, as well as the received downlink "**ACK**"? Great work!
{% endhint %}

***

## 🛰️ Listen for incoming UDP packets

Follow the steps below to configure the EVK in "server mode" (listening on a specific port).&#x20;

Requirements for sending UDP data to the Murata kit:

* **Public IP Mapping (NAT) or VPN Configuration**\
  Ensure the EVK is reachable via a public IP address, either through NAT port forwarding or a VPN tunnel. This is essential for delivering UDP packets to the device.
* **Static IP Assignment**\
  Assign a static IP address to the device within your APN to ensure consistent and reliable routing.

**Allocate UDP Socket in Listen Mode** (e.g., port 9000)

```bash
AT%SOCKETCMD="ALLOCATE",1,"UDP","LISTEN",,,9000,,,1
```

Expected Response: <mark style="color:red;">`%SOCKETCMD: 1`</mark>

**Activate the Listener**

```bash
AT%SOCKETCMD="ACTIVATE",1
```

Expected Response: <mark style="color:red;">`OK`</mark>

**Verify Listener Info (Optional)**

```bash
AT%SOCKETCMD="INFO",1
```

Expected Response: <mark style="color:red;">`%SOCKETCMD: "ACTIVATED","UDP","EVK_IP",,,9000`</mark>

**Send a UDP Message**

{% hint style="info" %}
Now use the UDP Sender application on your PC to send a UDP message to the EVK’s IP address and listening port.
{% endhint %}

**Wait for UDP Event Notification**

The modem will notify when a packet is received:

```
%SOCKETEV: 1,1
```

**Read Incoming UDP Data**

```bash
AT%SOCKETDATA="RECEIVE",1,1500
```

**Example Response:**

```
%SOCKETDATA: 1,1,1,"48656C6C6F0D0A","<Sender_IP>",54532  
OK
```

*(The hex string `"48656C6C6F0D0A"` decodes to `Hello`)*

**Close the Listener Socket**

```bash
AT%SOCKETCMD="DELETE",1
```

**Expected Response:**

```
OK
```

***

### Troubleshooting

* **No data received on server**: Check your firewall allows UDP port 9000 (`ufw allow 9000/udp`)
* **Connection timeout on device**: Verify the server IP address is correct
* **No downlink received**: Make sure to call `AT#XRECV` before closing the socket
* **General connectivity issues**: Check device logs at [hub.monogoto.io](https://hub.monogoto.io) to verify device registration and connection status


---

# 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/murata-type-1sc-send-receive-udp-data.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.
