|
| Family | family () const |
| |
|
virtual SocketType | type () const =0 |
| |
|
virtual IPProto | proto () const =0 |
| |
| Socket | getSocket () const |
| |
| void | remove () |
| |
| void | removeAndDelete () |
| |
| const SockaddrIn & | getAddress () const |
| |
| int64_t | getReconnectTime () const |
| |
| virtual bool | isAutoConnectEnabled () const |
| |
| virtual bool | isConnected () const |
| |
| bool | shouldRemove () const |
| |
| bool | shouldDelete () const |
| |
| void | setNonblocking (bool val=true) |
| | Sets socket non-blocking mode to val.
|
| |
| void | setDoNotProcess () |
| |
| virtual bool | reconnect () |
| |
| virtual bool | disconnect ()=0 |
| |
| bool | bind (uint16_t port) |
| |
| virtual bool | bind (AddrIn ip, uint16_t port) |
| | Sets this connection up as a listener that will listen for and respond to incoming connection requests on the specified port.
|
| |
| bool | send (const void *data, uint64_t byteCount, uint64_t &bytesSent) |
| | Attempts to send as much of the specified data as possible.
|
| |
| bool | receive (void *buffer, uint64_t byteCount, uint64_t &bytesReceived) |
| | Attempts to read the specified number of bytes from the network socket this connection represents.
|
| |
| bool | sendTo (const void *data, uint64_t byteCount, uint64_t &bytesSent, const SockaddrIn &addr) |
| | Attempts to send the specified data as a single datagram.
|
| |
| bool | recvFrom (void *buffer, uint64_t byteCount, uint64_t &bytesReceived, SockaddrIn &addr) |
| | Attempts to read the specified number of bytes from the network socket this connection represents.
|
| |
| virtual bool | processOutgoing () |
| |
| virtual bool | processIncoming () |
| |
|
| void | create () |
| | Internal wrapper for the socket() call.
|
| |
| void | close () |
| | Internal wrapper for closing the socket.
|
| |
|
| static constexpr uint32_t | cRemove = 0x00000001 |
| |
| static constexpr uint32_t | cDelete = 0x00000002 |
| |
| static constexpr uint32_t | cDoNotProcess = 0x00000004 |
| |
Definition at line 32 of file Connection.h.
◆ ConnectionBase()
| Cogs::Network::ConnectionBase::ConnectionBase |
( |
| ) |
|
|
inline |
◆ ~ConnectionBase()
| virtual Cogs::Network::ConnectionBase::~ConnectionBase |
( |
| ) |
|
|
inlinevirtual |
◆ bind() [1/2]
| bool Cogs::Network::ConnectionBase::bind |
( |
AddrIn |
ip, |
|
|
uint16_t |
port |
|
) |
| |
|
virtual |
◆ bind() [2/2]
| bool Cogs::Network::ConnectionBase::bind |
( |
uint16_t |
port | ) |
|
|
inline |
◆ close()
| void Cogs::Network::ConnectionBase::close |
( |
| ) |
|
|
protected |
Internal wrapper for closing the socket.
Definition at line 267 of file Connection.cpp.
◆ create()
| void Cogs::Network::ConnectionBase::create |
( |
| ) |
|
|
protected |
Internal wrapper for the socket() call.
Definition at line 252 of file Connection.cpp.
◆ disconnect()
| virtual bool Cogs::Network::ConnectionBase::disconnect |
( |
| ) |
|
|
pure virtual |
◆ family()
| Family Cogs::Network::ConnectionBase::family |
( |
| ) |
const |
|
inline |
◆ getAddress()
| const SockaddrIn & Cogs::Network::ConnectionBase::getAddress |
( |
| ) |
const |
|
inline |
◆ getReconnectTime()
| int64_t Cogs::Network::ConnectionBase::getReconnectTime |
( |
| ) |
const |
|
inline |
◆ getSocket()
| Socket Cogs::Network::ConnectionBase::getSocket |
( |
| ) |
const |
|
inline |
◆ isAutoConnectEnabled()
| virtual bool Cogs::Network::ConnectionBase::isAutoConnectEnabled |
( |
| ) |
const |
|
inlinevirtual |
◆ isConnected()
| virtual bool Cogs::Network::ConnectionBase::isConnected |
( |
| ) |
const |
|
inlinevirtual |
◆ processIncoming()
| virtual bool Cogs::Network::ConnectionBase::processIncoming |
( |
| ) |
|
|
inlinevirtual |
◆ processOutgoing()
| virtual bool Cogs::Network::ConnectionBase::processOutgoing |
( |
| ) |
|
|
inlinevirtual |
◆ receive()
| bool Cogs::Network::ConnectionBase::receive |
( |
void * |
buffer, |
|
|
uint64_t |
byteCount, |
|
|
uint64_t & |
bytesReceived |
|
) |
| |
Attempts to read the specified number of bytes from the network socket this connection represents.
If, when returning true, bytesReceived is less than the specified byteCount, this function should be recalled to receive the remaining data.
Definition at line 141 of file Connection.cpp.
Referenced by Cogs::Network::ConnectionHub::processIncoming().
◆ reconnect()
| virtual bool Cogs::Network::ConnectionBase::reconnect |
( |
| ) |
|
|
inlinevirtual |
◆ recvFrom()
| bool Cogs::Network::ConnectionBase::recvFrom |
( |
void * |
buffer, |
|
|
uint64_t |
byteCount, |
|
|
uint64_t & |
bytesReceived, |
|
|
SockaddrIn & |
addr |
|
) |
| |
Attempts to read the specified number of bytes from the network socket this connection represents.
This function should be called for UDP sockets. It offers no benefits over receive for TCP connections.
If, when returning true, bytesReceived is less than the specified byteCount (but not zero), additional datagram data will have been discarded by the OS. It is therefore recommended that this function be called with a buffer size of 65536 bytes to ensure that this function will retrieve exectly one (and only one) complete daragram.
Definition at line 220 of file Connection.cpp.
◆ remove()
| void Cogs::Network::ConnectionBase::remove |
( |
| ) |
|
|
inline |
◆ removeAndDelete()
| void Cogs::Network::ConnectionBase::removeAndDelete |
( |
| ) |
|
|
inline |
◆ send()
| bool Cogs::Network::ConnectionBase::send |
( |
const void * |
data, |
|
|
uint64_t |
byteCount, |
|
|
uint64_t & |
bytesSent |
|
) |
| |
Attempts to send as much of the specified data as possible.
If, when returning true, bytesSent is less than byteCount, this function should be recalled to send the remaining data.
Definition at line 105 of file Connection.cpp.
◆ sendTo()
| bool Cogs::Network::ConnectionBase::sendTo |
( |
const void * |
data, |
|
|
uint64_t |
byteCount, |
|
|
uint64_t & |
bytesSent, |
|
|
const SockaddrIn & |
addr |
|
) |
| |
Attempts to send the specified data as a single datagram.
sendTo should be used for UDP connections to send complete packets of data. It will not fragment the data. It will either queue (and send) the complete buffer, or fail immediately (in which case bytesSent will be zero).
Definition at line 182 of file Connection.cpp.
◆ setDoNotProcess()
| void Cogs::Network::ConnectionBase::setDoNotProcess |
( |
| ) |
|
|
inline |
◆ setNonblocking()
| void Cogs::Network::ConnectionBase::setNonblocking |
( |
bool |
val = true | ) |
|
Sets socket non-blocking mode to val.
Definition at line 60 of file Connection.cpp.
◆ shouldDelete()
| bool Cogs::Network::ConnectionBase::shouldDelete |
( |
| ) |
const |
|
inline |
◆ shouldRemove()
| bool Cogs::Network::ConnectionBase::shouldRemove |
( |
| ) |
const |
|
inline |
◆ cDelete
| constexpr uint32_t Cogs::Network::ConnectionBase::cDelete = 0x00000002 |
|
staticconstexprprotected |
◆ cDoNotProcess
| constexpr uint32_t Cogs::Network::ConnectionBase::cDoNotProcess = 0x00000004 |
|
staticconstexprprotected |
◆ cRemove
| constexpr uint32_t Cogs::Network::ConnectionBase::cRemove = 0x00000001 |
|
staticconstexprprotected |
◆ flags
| Cogs::Atomic< uint32_t > Cogs::Network::ConnectionBase::flags = 0 |
|
protected |
◆ reconnectTime
| int64_t Cogs::Network::ConnectionBase::reconnectTime = 0 |
|
protected |
◆ sockAddr
| SockaddrIn Cogs::Network::ConnectionBase::sockAddr = {} |
|
protected |
◆ socket
| Socket Cogs::Network::ConnectionBase::socket = InvalidSocket |
|
protected |
The documentation for this class was generated from the following files: