Public Member Functions | Protected Attributes | List of all members
sick_scan::ClientSocket Class Reference

#include <client_socket.h>

Public Member Functions

 ClientSocket (boost::asio::io_service &io_service)
 
virtual bool close (bool force_shutdown=false)
 
virtual bool connect (boost::asio::io_service &io_service, const std::string &server_adress, int tcp_port)
 
virtual boost::asio::ip::tcp::socket & socket (void)
 
virtual ~ClientSocket ()
 

Protected Attributes

boost::asio::ip::tcp::socket m_tcp_socket
 tcp client socket implementation More...
 

Detailed Description

Class sick_scan::ClientSocket encapsulates connecting, closing and setting socket options for tcp client sockets implemented by boost::asio::ip::tcp::socket.

Definition at line 71 of file client_socket.h.

Constructor & Destructor Documentation

◆ ClientSocket()

sick_scan::ClientSocket::ClientSocket ( boost::asio::io_service &  io_service)

Constructor.

Parameters
[in]io_serviceboost io service for tcp connections (several sockets may share one io_service)

Definition at line 64 of file client_socket.cpp.

◆ ~ClientSocket()

sick_scan::ClientSocket::~ClientSocket ( )
virtual

Destructor, closes all tcp connections.

Definition at line 71 of file client_socket.cpp.

Member Function Documentation

◆ close()

bool sick_scan::ClientSocket::close ( bool  force_shutdown = false)
virtual

Closes the tcp connection to the server.

Parameters
[in]force_shutdownif true, the socket is shutdown even if it's state is not opened or connected (otherwise the socket is closed, if its state is currently opened)
Returns
true on success (socket closed), false on failure

Definition at line 146 of file client_socket.cpp.

◆ connect()

bool sick_scan::ClientSocket::connect ( boost::asio::io_service &  io_service,
const std::string &  server_adress,
int  tcp_port 
)
virtual

Connects to a server.

Parameters
[in]io_serviceboost io service for tcp connections (several sockets may share one io_service)
[in]server_adressip adress of the localization controller, default: 192.168.0.1
[in]tcp_porttcp port for command requests, default: 2111 for command requests and 2112 for command responses
Returns
true on success, false on failure (server unknown or unreachable)

Definition at line 83 of file client_socket.cpp.

◆ socket()

virtual boost::asio::ip::tcp::socket& sick_scan::ClientSocket::socket ( void  )
inlinevirtual

Returns the tcp client socket implementation

Returns
tcp client socket implementation

Definition at line 107 of file client_socket.h.

Member Data Documentation

◆ m_tcp_socket

boost::asio::ip::tcp::socket sick_scan::ClientSocket::m_tcp_socket
protected

tcp client socket implementation

Definition at line 111 of file client_socket.h.


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


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Wed Sep 7 2022 02:25:06