plain socket implementation of NetworkAbstraction
More...
#include <socket.h>
plain socket implementation of NetworkAbstraction
Definition at line 80 of file socket.h.
◆ Socket()
Socket |
( |
ehs_socket_t |
fd, |
|
|
sockaddr_in * |
peer |
|
) |
| |
|
protected |
Constructs a new Socket, connected to a client.
- Parameters
-
fd | The socket descriptor of this connection. |
peer | The peer address of this socket |
◆ Accept()
◆ GetFd()
virtual ehs_socket_t GetFd |
( |
| ) |
const |
|
inlinevirtual |
◆ GetLocalAddress()
std::string GetLocalAddress |
( |
| ) |
const |
|
protectedvirtual |
◆ GetLocalPort()
int GetLocalPort |
( |
| ) |
const |
|
protectedvirtual |
◆ GetPeer()
std::string GetPeer |
( |
| ) |
const |
|
protectedvirtual |
Combination of GetRemoteAddress and GetRemotePort.
- Returns
- The address of the connected peer in quad-dotted format, followed by the port, separated by a colon.
Implements NetworkAbstraction.
Referenced by ThreadCleanup().
◆ GetRemoteAddress()
std::string GetRemoteAddress |
( |
| ) |
const |
|
protectedvirtual |
◆ GetRemotePort()
int GetRemotePort |
( |
| ) |
const |
|
protectedvirtual |
◆ Init()
virtual void Init |
( |
int |
port | ) |
|
|
virtual |
Initializes a listening socket.
If listening should be restricted to a specific address, SetBindAddress has to be called in advance.
- Parameters
-
port | The port to listen on. |
- Exceptions
-
A | std:runtime_error if initialization fails. |
Implements NetworkAbstraction.
◆ IsSecure()
virtual bool IsSecure |
( |
| ) |
const |
|
inlinevirtual |
Determines, whether the underlying socket is secure.
- Returns
- false, because this instance does not use SSL.
Implements NetworkAbstraction.
Definition at line 123 of file socket.h.
◆ Read()
virtual int Read |
( |
void * |
buf, |
|
|
int |
bufsize |
|
) |
| |
|
virtual |
Performs a read from the underlying socket.
- Parameters
-
buf | Pointer to a buffer that receives the incoming data. |
bufsize | The maximum number of bytes to read. |
- Returns
- The actual number of bytes that have been received or -1 if an error occured.
Implements NetworkAbstraction.
Referenced by GetFd().
◆ RegisterBindHelper()
◆ Send()
virtual int Send |
( |
const void * |
buf, |
|
|
size_t |
buflen, |
|
|
int |
flags = 0 |
|
) |
| |
|
virtual |
Performs a send on the underlying socket.
- Parameters
-
buf | Pointer to the data to be sent. |
buflen | The number of bytes to send. |
flags | Additional flags for the system call. |
- Returns
- The actual number of byte that have been sent or -1 if an error occured.
Implements NetworkAbstraction.
Referenced by GetFd().
◆ SetBindAddress()
virtual void SetBindAddress |
( |
const char * |
bindAddress | ) |
|
|
virtual |
Sets the bind address of the socket.
- Parameters
-
bindAddress | The address to bind to in quad-dotted format. |
Implements NetworkAbstraction.
The documentation for this class was generated from the following file: