Public Member Functions | Private Attributes | List of all members
visionary::TcpSocket Class Reference

#include <TcpSocket.h>

Inheritance diagram for visionary::TcpSocket:
Inheritance graph
[legend]

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 ()
 
- Public Member Functions inherited from visionary::ITransport
virtual ~ITransport ()
 

Private Attributes

SOCKET m_socket
 
SOCKET m_socketServer
 
SOCKET m_socketTcp
 

Detailed Description

Definition at line 50 of file TcpSocket.h.

Member Function Documentation

◆ connect()

int visionary::TcpSocket::connect ( const std::string &  hostname,
uint16_t  port 
)

Definition at line 26 of file TcpSocket.cpp.

◆ openServer()

int visionary::TcpSocket::openServer ( uint16_t  port)

Definition at line 80 of file TcpSocket.cpp.

◆ openTcp()

int visionary::TcpSocket::openTcp ( uint16_t  port)

Definition at line 118 of file TcpSocket.cpp.

◆ read()

int visionary::TcpSocket::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]bufferbuffer containing the bytes that shall be sent.
[in]maxBytesToReceivemaximum number of bytes to receive.
Returns
number of received bytes, negative values are OS error codes.

Implements visionary::ITransport.

Definition at line 207 of file TcpSocket.cpp.

◆ recv()

int visionary::TcpSocket::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]bufferbuffer containing the bytes that shall be sent.
[in]maxBytesToReceivemaximum number of bytes to receive.
Returns
number of received bytes, negative values are OS error codes.

Implements visionary::ITransport.

Definition at line 198 of file TcpSocket.cpp.

◆ send()

int visionary::TcpSocket::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]bufferbuffer containing the bytes that shall be sent.
Returns
OS error code.

Implements visionary::ITransport.

Definition at line 192 of file TcpSocket.cpp.

◆ shutdown()

int visionary::TcpSocket::shutdown ( )

Definition at line 172 of file TcpSocket.cpp.

◆ WaitForConnection()

bool visionary::TcpSocket::WaitForConnection ( )

Definition at line 154 of file TcpSocket.cpp.

Member Data Documentation

◆ m_socket

SOCKET visionary::TcpSocket::m_socket
private

Definition at line 64 of file TcpSocket.h.

◆ m_socketServer

SOCKET visionary::TcpSocket::m_socketServer
private

Definition at line 65 of file TcpSocket.h.

◆ m_socketTcp

SOCKET visionary::TcpSocket::m_socketTcp
private

Definition at line 66 of file TcpSocket.h.


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


sick_safevisionary_base
Author(s):
autogenerated on Sat Oct 21 2023 02:24:26