#include <TcpSocket.h>
Public Member Functions | |
int | connect (const std::string &hostname, uint16_t port) |
int | openServer (uint16_t port) |
int | openTcp (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 () |
bool | WaitForConnection () |
![]() | |
virtual | ~ITransport () |
Private Attributes | |
SOCKET | m_socket |
SOCKET | m_socketServer |
SOCKET | m_socketTcp |
Definition at line 50 of file TcpSocket.h.
int visionary::TcpSocket::connect | ( | const std::string & | hostname, |
uint16_t | port | ||
) |
Definition at line 26 of file TcpSocket.cpp.
int visionary::TcpSocket::openServer | ( | uint16_t | port | ) |
Definition at line 80 of file TcpSocket.cpp.
int visionary::TcpSocket::openTcp | ( | uint16_t | port | ) |
Definition at line 118 of file TcpSocket.cpp.
|
overridevirtual |
Read a number of bytes
Contrary to recv this method reads precisely nBytesToReceive bytes.
[in] | buffer | buffer containing the bytes that shall be sent. |
[in] | maxBytesToReceive | maximum number of bytes to receive. |
Implements visionary::ITransport.
Definition at line 207 of file TcpSocket.cpp.
|
overridevirtual |
Receive data on socket to device
Receive at most maxBytesToReceive bytes.
[in] | buffer | buffer containing the bytes that shall be sent. |
[in] | maxBytesToReceive | maximum number of bytes to receive. |
Implements visionary::ITransport.
Definition at line 198 of file TcpSocket.cpp.
|
overridevirtual |
Send data on socket to device
All bytes are sent on the socket. It is regarded as error if this is not possible.
[in] | buffer | buffer containing the bytes that shall be sent. |
Implements visionary::ITransport.
Definition at line 192 of file TcpSocket.cpp.
int visionary::TcpSocket::shutdown | ( | ) |
Definition at line 172 of file TcpSocket.cpp.
bool visionary::TcpSocket::WaitForConnection | ( | ) |
Definition at line 154 of file TcpSocket.cpp.
|
private |
Definition at line 64 of file TcpSocket.h.
|
private |
Definition at line 65 of file TcpSocket.h.
|
private |
Definition at line 66 of file TcpSocket.h.