Very Simple Cross-Platform Library
|
#include <TCPAcceptor.h>
Public Member Functions | |
bool | accept () |
TCPSocket * | getSocket (Waiter *waiter, size_t readingCapacity=LocalSocket::DEFAULT_CAPACITY, size_t writingCapacity=LocalSocket::DEFAULT_CAPACITY) |
TCPSocket * | 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< TCPAcceptor > | |
bool | failed () const |
errorCode_t | getErrorCode () const |
void | repair () |
An acceptor that provides a TCPSocket for each accepted connection.
Definition at line 45 of file TCPAcceptor.h.
bool hu::varadiistvan::scpl::io::TCPAcceptor::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.
TCPSocket* hu::varadiistvan::scpl::io::TCPAcceptor::getSocket | ( | size_t | readingCapacity = LocalSocket::DEFAULT_CAPACITY , |
size_t | writingCapacity = LocalSocket::DEFAULT_CAPACITY |
||
) |
Get the TCP socket accepted last. If no socket was accepted, return 0. The TCP socket's waiter will be the same as that of the associated server socket.
TCPSocket* hu::varadiistvan::scpl::io::TCPAcceptor::getSocket | ( | Waiter * | waiter, |
size_t | readingCapacity = LocalSocket::DEFAULT_CAPACITY , |
||
size_t | writingCapacity = LocalSocket::DEFAULT_CAPACITY |
||
) |
Get the TCP socket accepted last. If no socket was accepted, return 0. The TCP 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.