Cogs.Foundation
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Cogs::Network::ConnectionUDP Class Reference

#include <Connection.h>

Inheritance diagram for Cogs::Network::ConnectionUDP:
Cogs::Network::ConnectionBase

Public Member Functions

 ConnectionUDP ()=default
 
 ~ConnectionUDP ()
 
SocketType type () const override
 
IPProto proto () const override
 
void setMulticastAdapter (const AddrIn &addr)
 
virtual bool bind (AddrIn ip, uint16_t port) override
 Sets this connection up as a listener that will listen for and respond to incoming connection requests on the specified port.
 
virtual bool disconnect () override
 
- Public Member Functions inherited from Cogs::Network::ConnectionBase
 ConnectionBase ()
 
virtual ~ConnectionBase ()
 
Family family () const
 
virtual SocketType type () const =0
 
virtual IPProto proto () const =0
 
Socket getSocket () const
 
void remove ()
 
void removeAndDelete ()
 
const SockaddrIngetAddress () 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 as much of the specified data as possible.
 
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 ()
 

Private Attributes

AddrIn multicastAdapter
 

Additional Inherited Members

- Protected Member Functions inherited from Cogs::Network::ConnectionBase
void create ()
 Internal wrapper for the socket() call.
 
void close ()
 Internal wrapper for closing the socket.
 
- Protected Attributes inherited from Cogs::Network::ConnectionBase
Cogs::Atomic< uint32_t > flags = 0
 
int64_t reconnectTime = 0
 
Socket socket = InvalidSocket
 
SockaddrIn sockAddr = {}
 
- Static Protected Attributes inherited from Cogs::Network::ConnectionBase
static constexpr uint32_t cRemove = 0x00000001
 
static constexpr uint32_t cDelete = 0x00000002
 
static constexpr uint32_t cDoNotProcess = 0x00000004
 

Constructor & Destructor Documentation

◆ ConnectionUDP()

Cogs::Network::ConnectionUDP::ConnectionUDP ( )
default

◆ ~ConnectionUDP()

Cogs::Network::ConnectionUDP::~ConnectionUDP ( )

Member Function Documentation

◆ bind()

bool Cogs::Network::ConnectionUDP::bind ( AddrIn  ip,
uint16_t  port 
)
overridevirtual

Sets this connection up as a listener that will listen for and respond to incoming connection requests on the specified port.

Reimplemented from Cogs::Network::ConnectionBase.

References Cogs::Network::addConnection(), Cogs::Network::AddrIn::addr, check_net_error, InvalidSocket, LOG_ERROR, LOG_INFO, Cogs::logger, and Cogs::Network::AddrIn::string().

◆ disconnect()

bool Cogs::Network::ConnectionUDP::disconnect ( )
overridevirtual

◆ proto()

IPProto Cogs::Network::ConnectionUDP::proto ( ) const
inlineoverridevirtual

◆ setMulticastAdapter()

void Cogs::Network::ConnectionUDP::setMulticastAdapter ( const AddrIn addr)
inline

◆ type()

SocketType Cogs::Network::ConnectionUDP::type ( ) const
inlineoverridevirtual

Member Data Documentation

◆ multicastAdapter

AddrIn Cogs::Network::ConnectionUDP::multicastAdapter
private

The documentation for this class was generated from the following files: