#include <Socket.h>
OS-independent abstraction of a socket.
NOTE: Construction of Socket might throw tenduke::net::NetworkingException
|
| virtual std::unique_ptr< Socket > | accept (uint32_t timeoutMs)=0 |
| | Accepts next connection from listening socket, with a timeout.
|
| |
| virtual std::unique_ptr< Socket > | accept ()=0 |
| | Accepts next connection from listening socket.
|
| |
| virtual void | bind (std::uint32_t ipAddress, std::uint16_t port)=0 |
| | Binds the socket.
|
| |
| virtual void | listen ()=0 |
| | Configures the socket to listen for incoming connections.
|
| |
| virtual int | read (void *buffer, std::size_t bufferSize)=0 |
| | Reads bytes from the socket.
|
| |
| virtual int | write (const void *buffer, std::size_t len)=0 |
| | Write bytes to the socket.
|
| |
| virtual std::uint16_t | getPort () const =0 |
| | Returns port of the socket.
|
| |
| virtual void | setNonBlocking ()=0 |
| | Sets the socket to non-blocking mode.
|
| |
◆ accept() [1/2]
| virtual std::unique_ptr< Socket > tenduke::osa::Socket::accept |
( |
| ) |
|
|
pure virtual |
◆ accept() [2/2]
| virtual std::unique_ptr< Socket > tenduke::osa::Socket::accept |
( |
uint32_t | timeoutMs | ) |
|
|
pure virtual |
◆ bind()
| virtual void tenduke::osa::Socket::bind |
( |
std::uint32_t | ipAddress, |
|
|
std::uint16_t | port ) |
|
pure virtual |
Binds the socket.
- Parameters
-
| ipAddress | IP address to bind to (in host byte order) |
| port | port to bind to |
◆ getPort()
| virtual std::uint16_t tenduke::osa::Socket::getPort |
( |
| ) |
const |
|
pure virtual |
Returns port of the socket.
- Returns
- the port number
◆ listen()
| virtual void tenduke::osa::Socket::listen |
( |
| ) |
|
|
pure virtual |
◆ read()
| virtual int tenduke::osa::Socket::read |
( |
void * | buffer, |
|
|
std::size_t | bufferSize ) |
|
pure virtual |
◆ setNonBlocking()
| virtual void tenduke::osa::Socket::setNonBlocking |
( |
| ) |
|
|
pure virtual |
Sets the socket to non-blocking mode.
- Exceptions
-
◆ write()
| virtual int tenduke::osa::Socket::write |
( |
const void * | buffer, |
|
|
std::size_t | len ) |
|
pure virtual |
The documentation for this class was generated from the following file: