|
E-MailRelay
|
A derivation of GNet::Socket for a datagram socket. More...
#include <gsocket.h>
Inheritance diagram for GNet::DatagramSocket:Public Member Functions | |
| DatagramSocket (int address_domain) | |
| Constructor with a hint of a local address. | |
| virtual | ~DatagramSocket () |
| Destructor. | |
| virtual ssize_type | read (char *buffer, size_type len) override |
| Override from Socket::read(). | |
| virtual ssize_type | write (const char *buffer, size_type len) override |
| Override from Socket::write(). | |
| ssize_type | readfrom (char *buffer, size_type len, Address &src) |
| Reads a datagram and returns the sender's address by reference. More... | |
| ssize_type | writeto (const char *buffer, size_type len, const Address &dst) |
| Sends a datagram to the given address. More... | |
| void | disconnect () |
| Releases the association between two datagram endpoints reversing the effect of the previous Socket::connect(). More... | |
Public Member Functions inherited from GNet::Socket | |
| virtual | ~Socket () |
| Destructor. | |
| std::pair< bool, Address > | getLocalAddress () const |
| Retrieves local address of the socket. More... | |
| std::pair< bool, Address > | getPeerAddress () const |
| Retrieves address of socket's peer. More... | |
| bool | hasPeer () const |
| Returns true if the socket has a valid peer. More... | |
| void | bind (const Address &) |
| Binds the socket with the given address. | |
| bool | bind (const Address &, NoThrow) |
| No-throw overload. Returns false on error. | |
| bool | canBindHint (const Address &address) |
| Returns true if the socket can probably be bound with the given address. More... | |
| bool | connect (const Address &addr, bool *done=nullptr) |
| Initiates a connection to (or association with) the given address. More... | |
| void | listen (int backlog=1) |
| Starts the socket listening on the bound address for incoming connections or incoming datagrams. More... | |
| void | shutdown (int how=1) |
| Modifies the local socket state so that so that new sends (1 or 2) and/or receives (0 or 2) will fail. More... | |
| virtual SOCKET | fd () const override |
| Returns the socket descriptor. Override from G::ReadWrite. | |
| virtual bool | eWouldBlock () override |
| Returns true if the previous socket operation failed because the socket would have blocked. More... | |
| bool | eInProgress () |
| Returns true if the previous socket operation failed with the EINPROGRESS error status. More... | |
| bool | eMsgSize () |
| Returns true if the previous socket operation failed with the EMSGSIZE error status. More... | |
| void | addReadHandler (EventHandler &, ExceptionHandler &) |
| Adds this socket to the event source list so that the given handler receives read events. More... | |
| void | dropReadHandler () |
| Reverses addReadHandler(). | |
| void | addWriteHandler (EventHandler &, ExceptionHandler &) |
| Adds this socket to the event source list so that the given handler receives write events when flow control is released. More... | |
| void | dropWriteHandler () |
| Reverses addWriteHandler(). | |
| void | addOtherHandler (EventHandler &, ExceptionHandler &) |
| Adds this socket to the event source list so that the given handler receives exception events. More... | |
| void | dropOtherHandler () |
| Reverses addOtherHandler(). | |
| std::string | asString () const |
| Returns the socket handle as a string. More... | |
| std::string | reason () const |
| Returns the reason for the previous error. | |
Public Member Functions inherited from G::ReadWrite | |
| virtual | ~ReadWrite () |
| Destructor. | |
Additional Inherited Members | |
Public Types inherited from GNet::Socket | |
| typedef G::ReadWrite::size_type | size_type |
| typedef G::ReadWrite::ssize_type | ssize_type |
Public Types inherited from G::ReadWrite | |
| typedef size_t | size_type |
| typedef ssize_t | ssize_type |
Protected Member Functions inherited from GNet::Socket | |
| Socket (int domain, int type, int protocol) | |
| Constructor used by derived classes. More... | |
| Socket (Descriptor s, const Accepted &) | |
| Constructor which creates a socket object from a socket handle from accept(). More... | |
| bool | create (int, int, int) |
| void | saveReason () |
| void | saveReason () const |
| bool | prepare (bool) |
| std::pair< bool, Address > | getAddress (bool) const |
| void | setOptionsOnBind (bool) |
| void | setOptionsOnConnect (bool) |
| void | setOptionLingerImp (int, int) |
| void | setOptionNoLinger () |
| void | setOptionReuse () |
| void | setOptionExclusive () |
| void | setOptionPureV6 (bool) |
| bool | setOptionPureV6 (bool, NoThrow) |
| void | setOptionKeepAlive () |
Static Protected Member Functions inherited from GNet::Socket | |
| static std::string | reasonString (int) |
| static bool | error (int rc) |
| static bool | sizeError (ssize_type size) |
Protected Attributes inherited from GNet::Socket | |
| int | m_reason |
| std::string | m_reason_string |
| int | m_domain |
| Descriptor | m_socket |
| HANDLE | m_handle |
A derivation of GNet::Socket for a datagram socket.
| void GNet::DatagramSocket::disconnect | ( | ) |
Releases the association between two datagram endpoints reversing the effect of the previous Socket::connect().
Definition at line 345 of file gsocket.cpp.
| GNet::Socket::ssize_type GNet::DatagramSocket::readfrom | ( | char * | buffer, |
| size_type | len, | ||
| Address & | src | ||
| ) |
Reads a datagram and returns the sender's address by reference.
If connect() has been used then only datagrams from the address specified in the connect() call will be received.
Definition at line 366 of file gsocket.cpp.
| GNet::Socket::ssize_type GNet::DatagramSocket::writeto | ( | const char * | buffer, |
| size_type | len, | ||
| const Address & | dst | ||
| ) |
Sends a datagram to the given address.
This should be used if there is no connect() assocation in effect.
Definition at line 381 of file gsocket.cpp.
1.8.9.1