> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nanoforge.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# UDPServer class

> Unreliable, unordered WebRTC data-channel server that manages multiple UDP clients.

# UDPServer

## Summary

Unreliable, unordered WebRTC data-channel server that manages multiple UDP clients.

## Signature

```typescript theme={null}
declare class UDPServer 
```

## Constructors

### constructor

Constructs a new instance of the class

## Methods

### getConnectedClients

Return a snapshot array of client IDs with active data channels.

### getReceivedPackets

Reassemble buffered chunks and return a map of clientId = complete packets. Partial packets are retained internally for the next call so callers may repeatedly poll this method to consume newly arrived data.

### listen

Start the signaling WebSocket and accept incoming client offers (SDP/ICE).

### sendToClient

Send a packet to a single client via the unreliable data channel. The packet will be framed with the server's configured magic terminator bytes before being sent.

### sendToEverybody

Broadcast a packet to all connected clients over the unreliable data channels. The server will frame the provided data with the configured magic terminator.

## Remarks

Uses a WebSocket signaling server to complete SDP/ICE handshakes and then communicates over RTCDataChannels. Each connected client is assigned a numeric ID. Use `getConnectedClients` to enumerate active clients, `sendToClient` / `sendToEverybody` to push data, and `getReceivedPackets` to consume incoming packets per frame.  Typical usage is through `NetworkServerLibrary` which instantiates and starts this class automatically during `__init`.
