USRP Hardware Driver and USRP Manual: uhd::transport::udp_simple Class Reference

| USRP Hardware Driver and USRP Manual Version: 4.9.0.makepkg-0-g9ec1f582 UHD and USRP Manual |

Loading...
Searching...
No Matches
uhd::transport::udp_simple Class Referenceabstract

`#include <uhd/transport/udp_simple.hpp>`

Inheritance diagram for uhd::transport::udp_simple:

## Public Types
typedef std::shared_ptr< udp_simple > | sptr

## Public Member Functions
virtual | ~udp_simple (void)=0
virtual size_t | send (const boost::asio::const_buffer &buff)=0
virtual size_t | recv (const boost::asio::mutable_buffer &buff, double timeout=0.1)=0
virtual std::string | get_recv_addr (void)=0
virtual std::string | get_send_addr (void)=0

## Static Public Member Functions
static sptr | make_connected (const std::string &addr, const std::string &port)
static sptr | make_broadcast (const std::string &addr, const std::string &port)
static uart_iface::sptr | make_uart (sptr udp)

## Static Public Attributes
static const size_t | mtu = 1500 - 20 - 8
| The maximum number of bytes per udp packet.

## Member Typedef Documentation

## ◆ sptr

typedef std::shared_ptr<udp_simple> uhd::transport::udp_simple::sptr

## Constructor & Destructor Documentation

## ◆ ~udp_simple()

virtual uhd::transport::udp_simple::~udp_simple | ( | void |  | ) |
| pure virtual

## Member Function Documentation

## ◆ get_recv_addr()

virtual std::string uhd::transport::udp_simple::get_recv_addr | ( | void |  | ) |
| pure virtual

Get the last IP address as seen by recv(). Only use this with the broadcast socket.

## ◆ get_send_addr()

virtual std::string uhd::transport::udp_simple::get_send_addr | ( | void |  | ) |
| pure virtual

Get the IP address for the destination

## ◆ make_broadcast()

sptr uhd::transport::udp_simple::make_broadcast | ( | const std::string & | addr,
|  | const std::string & | port )
| static

Make a new broadcasting udp transport: This transport can send udp broadcast datagrams and receive datagrams from multiple sources. The primary usage for this transport will be to discover devices.

The address will be resolved, it can be a host name or ipv4. The port will be resolved, it can be a port type or number.

Parameters

  addr | a string representing the destination address
  port | a string representing the destination port

## ◆ make_connected()

sptr uhd::transport::udp_simple::make_connected | ( | const std::string & | addr,
|  | const std::string & | port )
| static

Make a new connected udp transport: This transport is for sending and receiving between this host and a single endpoint. The primary usage for this transport will be control transactions. The underlying implementation is simple and portable (not fast).

The address will be resolved, it can be a host name or ipv4. The port will be resolved, it can be a port type or number.

Parameters

  addr | a string representing the destination address
  port | a string representing the destination port

## ◆ make_uart()

uart_iface::sptr uhd::transport::udp_simple::make_uart | ( | sptr | udp | ) |
| static

Make a UART interface from a UDP transport.

Parameters

  udp | the UDP transport object

Returns
  a new UART interface

## ◆ recv()

virtual size_t uhd::transport::udp_simple::recv | ( | const boost::asio::mutable_buffer & | buff,
|  | double | timeout = 0.1 )
| pure virtual

Receive into the provided buffer. Blocks until data is received or a timeout occurs.

Parameters

  buff | a mutable buffer to receive into
  timeout | the timeout in seconds

Returns
  the number of bytes received or zero on timeout

## ◆ send()

virtual size_t uhd::transport::udp_simple::send | ( | const boost::asio::const_buffer & | buff | ) |
| pure virtual

Send a single buffer. Blocks until the data is sent.

Parameters

  buff | single asio buffer

Returns
  the number of bytes sent

## Member Data Documentation

## ◆ mtu

const size_t uhd::transport::udp_simple::mtu = 1500 - 20 - 8
| static

The maximum number of bytes per udp packet.

The documentation for this class was generated from the following file:

- udp_simple.hpp