#include <TcpSocket.h>
Definition at line 19 of file TcpSocket.h.
◆ ByteBuffer
◆ TcpSocket()
visionary::TcpSocket::TcpSocket |
( |
| ) |
|
◆ ~TcpSocket()
visionary::TcpSocket::~TcpSocket |
( |
| ) |
|
|
virtual |
◆ connect()
int visionary::TcpSocket::connect |
( |
const std::string & |
ipaddr, |
|
|
std::uint16_t |
port, |
|
|
std::uint32_t |
timeoutMs = 5000 |
|
) |
| |
connect to a peer via TCP
- 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 |
-1 | connect failed (the socket could be created, the ip address format is invalid or the device cannot be contacted) |
Definition at line 36 of file TcpSocket.cpp.
◆ getLastError()
int visionary::TcpSocket::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 255 of file TcpSocket.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 237 of file TcpSocket.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::TcpSocket::shutdown |
( |
| ) |
|
|
overridevirtual |
◆ m_pSockRecord
std::unique_ptr<SockRecord> visionary::TcpSocket::m_pSockRecord |
|
private |
The documentation for this class was generated from the following files: