#include <UdpSocket.h>
|
int | bindPort (std::uint16_t port) |
|
int | connect (const std::string &hostname, uint16_t port) |
|
int | read (std::vector< std::uint8_t > &buffer, std::size_t nBytesToReceive) override |
|
int | recv (std::vector< std::uint8_t > &buffer, std::size_t maxBytesToReceive) override |
|
int | send (const std::vector< std::uint8_t > &buffer) override |
|
int | shutdown () |
|
| UdpSocket () |
|
virtual | ~ITransport () |
|
Definition at line 50 of file UdpSocket.h.
◆ UdpSocket()
visionary::UdpSocket::UdpSocket |
( |
| ) |
|
◆ bindPort()
int visionary::UdpSocket::bindPort |
( |
std::uint16_t |
port | ) |
|
◆ connect()
int visionary::UdpSocket::connect |
( |
const std::string & |
hostname, |
|
|
uint16_t |
port |
|
) |
| |
◆ initSocket()
int visionary::UdpSocket::initSocket |
( |
| ) |
|
|
private |
◆ read()
int visionary::UdpSocket::read |
( |
std::vector< std::uint8_t > & |
buffer, |
|
|
std::size_t |
nBytesToReceive |
|
) |
| |
|
overridevirtual |
Read a number of bytes
Contrary to recv this method reads precisely nBytesToReceive bytes.
- Parameters
-
[in] | buffer | buffer containing the bytes that shall be sent. |
[in] | maxBytesToReceive | maximum number of bytes to receive. |
- Returns
- number of received bytes, negative values are OS error codes.
Implements visionary::ITransport.
Definition at line 157 of file UdpSocket.cpp.
◆ recv()
int visionary::UdpSocket::recv |
( |
std::vector< std::uint8_t > & |
buffer, |
|
|
std::size_t |
maxBytesToReceive |
|
) |
| |
|
overridevirtual |
Receive data on socket to device
Receive at most maxBytesToReceive bytes.
- Parameters
-
[in] | buffer | buffer containing the bytes that shall be sent. |
[in] | maxBytesToReceive | maximum number of bytes to receive. |
- Returns
- number of received bytes, negative values are OS error codes.
Implements visionary::ITransport.
Definition at line 148 of file UdpSocket.cpp.
◆ send()
int visionary::UdpSocket::send |
( |
const std::vector< std::uint8_t > & |
buffer | ) |
|
|
overridevirtual |
Send data on socket to device
All bytes are sent on the socket. It is regarded as error if this is not possible.
- Parameters
-
[in] | buffer | buffer containing the bytes that shall be sent. |
- Returns
- OS error code.
Implements visionary::ITransport.
Definition at line 137 of file UdpSocket.cpp.
◆ shutdown()
int visionary::UdpSocket::shutdown |
( |
| ) |
|
◆ m_socket
SOCKET visionary::UdpSocket::m_socket |
|
private |
◆ m_udpAddr
struct sockaddr_in visionary::UdpSocket::m_udpAddr |
|
private |
The documentation for this class was generated from the following files: