Very Simple Cross-Platform Library
|
#include <LocalAcceptor.h>
Public Member Functions | |
bool | accept () |
LocalSocket * | getSocket (Waiter *waiter, size_t readingCapacity=LocalSocket::DEFAULT_CAPACITY, size_t writingCapacity=LocalSocket::DEFAULT_CAPACITY) |
LocalSocket * | getSocket (size_t readingCapacity=LocalSocket::DEFAULT_CAPACITY, size_t writingCapacity=LocalSocket::DEFAULT_CAPACITY) |
BufferedStream * | getAcceptedBufferedStream (Waiter *waiter=nullptr) override |
Public Member Functions inherited from hu::varadiistvan::scpl::io::FailableReference< LocalAcceptor > | |
bool | failed () const |
errorCode_t | getErrorCode () const |
void | repair () |
An acceptor that provides a LocalSocket for each accepted connection.
Definition at line 45 of file LocalAcceptor.h.
bool hu::varadiistvan::scpl::io::LocalAcceptor::accept | ( | ) |
Start accepting a connection.
If a connection is already accepted, but not retrieved yet, it returns true.
If a new socket becomes immediately available, it returns true.
If some error occurs, the acceptor is marked as failed.
|
overridevirtual |
Get the last accepted socket with the given waiter, if any.
Implements hu::varadiistvan::scpl::io::BufferedStreamAcceptor.
LocalSocket* hu::varadiistvan::scpl::io::LocalAcceptor::getSocket | ( | size_t | readingCapacity = LocalSocket::DEFAULT_CAPACITY , |
size_t | writingCapacity = LocalSocket::DEFAULT_CAPACITY |
||
) |
Get the local socket accepted last. If no socket was accepted, return 0. The local socket's waiter will be the same as that of the associated server socket.
LocalSocket* hu::varadiistvan::scpl::io::LocalAcceptor::getSocket | ( | Waiter * | waiter, |
size_t | readingCapacity = LocalSocket::DEFAULT_CAPACITY , |
||
size_t | writingCapacity = LocalSocket::DEFAULT_CAPACITY |
||
) |
Get the local socket accepted last. If no socket was accepted, return 0. The local socket's waiter will be the given one. If the server socket has no waiter, this one should be 0. If the server socket has a waiter, this one should not be 0. In other words, if the server socket is non-blocking, the accepted one should also be non-blocking, if the server socket is blocking, the accepted one should also be blocking.