#include <UdpSocket.h>
Definition at line 19 of file UdpSocket.h.
◆ UdpSocket()
visionary::UdpSocket::UdpSocket |
( |
| ) |
|
◆ ~UdpSocket()
visionary::UdpSocket::~UdpSocket |
( |
| ) |
|
|
virtual |
◆ connect()
int visionary::UdpSocket::connect |
( |
const std::string & |
ipaddr, |
|
|
std::uint16_t |
port |
|
) |
| |
connect to a peer via UDP
actually UDP is connectionless, so this method just stored the target address and uses thestored adresse for successive calls to send, \ recv and read.
- Parameters
-
[in] | ipaddr | string representation of the device ip address ("xx.xx.xx.xx") |
[in] | port | number of the device port to connect to (in host byte order) |
- Return values
-
0 | connect successful (in this case: the socket could be created) |
-1 | connect failed (in this case: no socket could be created or the ip address format is invalid) |
Definition at line 52 of file UdpSocket.cpp.
◆ getLastError()
int visionary::UdpSocket::getLastError |
( |
| ) |
|
|
overridevirtual |
◆ read()
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] | nBytesToReceive | maximum number of bytes to receive. |
- Returns
- number of received bytes or (-1) on error
Implements visionary::ITransport.
Definition at line 164 of file UdpSocket.cpp.
◆ recv()
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 or (-1) on error
Implements visionary::ITransport.
Definition at line 146 of file UdpSocket.cpp.
◆ send() [1/3]
◆ send() [2/3]
◆ send() [3/3]
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
- Number of bytes sent or (-1) on error
Definition at line 45 of file ITransport.h.
◆ shutdown()
int visionary::UdpSocket::shutdown |
( |
| ) |
|
|
overridevirtual |
◆ Conv
◆ m_pSockAddrIn
std::unique_ptr<SockAddrIn> visionary::UdpSocket::m_pSockAddrIn |
|
private |
◆ m_pSockRecord
std::unique_ptr<SockRecord> visionary::UdpSocket::m_pSockRecord |
|
private |
The documentation for this class was generated from the following files: