---
title: llarp::UDPHandle

---

# llarp::UDPHandle





## Public Types

|                | Name           |
| -------------- | -------------- |
| using EventLoop::UDPReceiveFunc | **[ReceiveFunc](Classes/structllarp_1_1UDPHandle.md#using-receivefunc)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| virtual bool | **[listen](Classes/structllarp_1_1UDPHandle.md#function-listen)**(const [SockAddr](Classes/structllarp_1_1SockAddr.md) & addr) =0 |
| virtual bool | **[send](Classes/structllarp_1_1UDPHandle.md#function-send)**(const [SockAddr](Classes/structllarp_1_1SockAddr.md) & dest, const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & buf) =0 |
| virtual void | **[close](Classes/structllarp_1_1UDPHandle.md#function-close)**() =0 |
| virtual std::optional< int > | **[file_descriptor](Classes/structllarp_1_1UDPHandle.md#function-file-descriptor)**() |
| virtual std::optional< [SockAddr](Classes/structllarp_1_1SockAddr.md) > | **[LocalAddr](Classes/structllarp_1_1UDPHandle.md#function-localaddr)**() const =0<br>returns the local address we are bound on  |
| virtual | **[~UDPHandle](Classes/structllarp_1_1UDPHandle.md#function-~udphandle)**() =default |

## Protected Functions

|                | Name           |
| -------------- | -------------- |
| | **[UDPHandle](Classes/structllarp_1_1UDPHandle.md#function-udphandle)**(ReceiveFunc on_recv) |

## Protected Attributes

|                | Name           |
| -------------- | -------------- |
| ReceiveFunc | **[on_recv](Classes/structllarp_1_1UDPHandle.md#variable-on-recv)**  |

## Public Types Documentation

### using ReceiveFunc

```cpp
using llarp::UDPHandle::ReceiveFunc =  EventLoop::UDPReceiveFunc;
```


## Public Functions Documentation

### function listen

```cpp
virtual bool listen(
    const SockAddr & addr
) =0
```


### function send

```cpp
virtual bool send(
    const SockAddr & dest,
    const llarp_buffer_t & buf
) =0
```


### function close

```cpp
virtual void close() =0
```


### function file_descriptor

```cpp
inline virtual std::optional< int > file_descriptor()
```


### function LocalAddr

```cpp
virtual std::optional< SockAddr > LocalAddr() const =0
```

returns the local address we are bound on 

### function ~UDPHandle

```cpp
virtual ~UDPHandle() =default
```


## Protected Functions Documentation

### function UDPHandle

```cpp
inline explicit UDPHandle(
    ReceiveFunc on_recv
)
```


## Protected Attributes Documentation

### variable on_recv

```cpp
ReceiveFunc on_recv;
```


-------------------------------

Updated on 2023-02-01 at 20:39:32 +0000