|
rohdeschwarz
0.2.0
TCPIP socket library for Rohde & Schwarz instrument control
|
A class for managing synchronous TCP IP sockets. More...
#include <socket.hpp>
Public Member Functions | |
| Socket (const char *host, int port=5025) | |
| Constructor. More... | |
| Socket (const std::string &host, int port=5025) | |
| Constructor. More... | |
| virtual | ~Socket () |
| Destructor. More... | |
| std::string | host () const |
| returns the host or ip address More... | |
| int | port () const |
| returns the port More... | |
| virtual std::string | endpoint () const |
| Returns string '{host}:{port}'. More... | |
| virtual int | timeout_ms () const |
| Get timeout, in ms. More... | |
| virtual bool | setTimeout (int timeout_ms) |
| Set timeout, in ms. More... | |
| virtual bool | readData (unsigned char *buffer, std::size_t bufferSize, std::size_t *readSize=nullptr) |
| read data into buffer More... | |
| virtual bool | writeData (const unsigned char *data, std::size_t dataSize, std::size_t *writeSize=nullptr) |
| read data into buffer More... | |
| virtual bool | isError () const |
| Checks socket state for error. More... | |
| virtual std::string | statusMessage () const |
| human-readable bus status message More... | |
Public Member Functions inherited from rohdeschwarz::busses::Bus | |
| Bus () | |
| Constructor. More... | |
| virtual | ~Bus () |
| Destructor. More... | |
| std::size_t | bufferSize_B () const |
| void | setBufferSize (std::size_t bytes) |
| std::vector< unsigned char > * | buffer () |
| const std::vector< unsigned char > * | buffer () const |
| std::vector< unsigned char > | takeData () |
| bool | readData (std::size_t *readSize=nullptr) |
A class for managing synchronous TCP IP sockets.
Definition at line 38 of file socket.hpp.
| Socket::Socket | ( | const char * | host, |
| int | port = 5025 |
||
| ) |
Constructor.
Constructs a socket object that is connected to server host, port
| [in] | host | host or ip address |
| [in] | port | port number |
| <tt>boost::system::system_error</tt> | if connection fails |
Definition at line 29 of file socket.cpp.
| Socket::Socket | ( | const std::string & | host, |
| int | port = 5025 |
||
| ) |
Constructor.
Constructs a socket object that is connected to server host, port
| [in] | host | host or ip address |
| [in] | port | port number |
| <tt>boost::system::system_error</tt> | if connection fails |
Definition at line 39 of file socket.cpp.
|
virtual |
Destructor.
The destructor closes the socket if it is currently open
Definition at line 49 of file socket.cpp.
|
virtual |
Returns string '{host}:{port}'.
Implements rohdeschwarz::busses::Bus.
Definition at line 67 of file socket.cpp.
| std::string Socket::host | ( | ) | const |
returns the host or ip address
Definition at line 55 of file socket.cpp.
|
virtual |
Checks socket state for error.
Implements rohdeschwarz::busses::Bus.
Definition at line 175 of file socket.cpp.
| int Socket::port | ( | ) | const |
returns the port
Definition at line 61 of file socket.cpp.
|
virtual |
read data into buffer
| [in] | buffer | Buffer for read |
| [in] | bufferSize | Size of buffer |
| [out] | readSize | Returns bytes read |
Implements rohdeschwarz::busses::Bus.
Definition at line 119 of file socket.cpp.
|
virtual |
|
virtual |
human-readable bus status message
Implements rohdeschwarz::busses::Bus.
Definition at line 181 of file socket.cpp.
|
virtual |
|
virtual |
read data into buffer
| [in] | data | Data to be written |
| [in] | dataSize | Size of data to be written |
| [out] | writeSize | Returns bytes written |
Implements rohdeschwarz::busses::Bus.
Definition at line 147 of file socket.cpp.