#include <socket_private.hh>
Public Types | |
enum | State |
State of socket. More... | |
Public Member Functions | |
void | Constructor () |
General constructor. | |
void | SetError (int eno, const char *text) |
Set error. | |
void | SetError (const char *text) |
Set error text. | |
bool | SetSoError (const char *prefix, const char *text) |
Set socket error. | |
int | GetSoError (int s, int &optval) |
Get error. | |
int | SetNonblocking (bool on) |
Set socket (non)blocking. | |
int | Init (int domain=AF_INET) |
Initialize a socket. | |
size_t | DoSend () |
Try to send data. | |
size_t | DoRecv () |
Try to receive data. | |
Public Attributes | |
int | mFd |
socket's file descriptor | |
int | mPort |
port socket is connected to | |
int | mErrno |
error number | |
std::string | mError |
error string | |
bool | mIsConnected |
connected status | |
const char * | mpDataToSend |
data to send | |
const char * | mpSendPtr |
ptr to mpDataToSend keeping position of next send | |
size_t | mLenToSend |
number of bytes to send | |
AbsMsecTime | mSendTimeoutMs |
timeout of send operation in absolute ms time | |
char | mRecvBuf [RECV_BUF_SIZE] |
buffer for receiving | |
char * | mpRecvPtr |
pointer to mRecvBuf where recv will be done | |
AbsMsecTime | mRecvTimeoutMs |
timeout of recv operation in absolute time | |
size_t | mLenToRecv |
number of bytes that can be received (fit to the buffer) | |
AbsMsecTime | mAcceptTimeoutMsAbs |
timeout of accept operation in absolute time | |
Netman * | mpNetman |
pointer netman class | |
bool | mTerminationRequest |
termination request | |
bool | mIsSocket |
true if fd is a socket | |
Classes | |
struct | Event |
Struct filled in upon calling Event() by netman. More... | |
struct | SocketType |
void nnl::Socket::Impl::Constructor | ( | ) | [inline] |
General constructor.
General constructor as delegating constructors are not yet supported.
size_t nnl::Socket::Impl::DoRecv | ( | ) | [inline] |
Try to receive data.
Try to receive some data without blocking. If blocking occures, exit.
size_t nnl::Socket::Impl::DoSend | ( | ) | [inline] |
Try to send data.
Try to send all the data without blocking. If blocking occures, exit. Optimized assuming the first send() op sends all the data.
int nnl::Socket::Impl::GetSoError | ( | int | s, | |
int & | optval | |||
) | [inline] |
Get error.
Get error using getsockopt().
s | file descriptor | |
optval | error value |
int nnl::Socket::Impl::Init | ( | int | domain = AF_INET |
) | [inline] |
Initialize a socket.
A new socket is created.
void nnl::Socket::Impl::SetError | ( | const char * | text | ) | [inline] |
Set error text.
Called upon custom error. Set internal variables to hold error messages. Also set mIsConnected to false indicated socket is not connected.
text | error text |
void nnl::Socket::Impl::SetError | ( | int | eno, | |
const char * | text | |||
) | [inline] |
Set error.
Called upon error. Set internal variables to hold error messages. Also set mIsConnected to false indicated socket is not connected.
eno | value of errno | |
text | error text |
int nnl::Socket::Impl::SetNonblocking | ( | bool | on | ) | [inline] |
Set socket (non)blocking.
on | true if set to non-blocking, false if set to blocking |
bool nnl::Socket::Impl::SetSoError | ( | const char * | prefix, | |
const char * | text | |||
) | [inline] |
Set socket error.
prefix | error prefix | |
text | error text |