Very Simple Cross-Platform Library
Public Member Functions | List of all members
hu::varadiistvan::scpl::io::LocalAcceptor Class Reference

#include <LocalAcceptor.h>

Inheritance diagram for hu::varadiistvan::scpl::io::LocalAcceptor:
hu::varadiistvan::scpl::io::FailableReference< LocalAcceptor > hu::varadiistvan::scpl::io::BufferedStreamAcceptor

Public Member Functions

bool accept ()
 
LocalSocketgetSocket (Waiter *waiter, size_t readingCapacity=LocalSocket::DEFAULT_CAPACITY, size_t writingCapacity=LocalSocket::DEFAULT_CAPACITY)
 
LocalSocketgetSocket (size_t readingCapacity=LocalSocket::DEFAULT_CAPACITY, size_t writingCapacity=LocalSocket::DEFAULT_CAPACITY)
 
BufferedStreamgetAcceptedBufferedStream (Waiter *waiter=nullptr) override
 
- Public Member Functions inherited from hu::varadiistvan::scpl::io::FailableReference< LocalAcceptor >
bool failed () const
 
errorCode_t getErrorCode () const
 
void repair ()
 

Detailed Description

An acceptor that provides a LocalSocket for each accepted connection.

Definition at line 45 of file LocalAcceptor.h.

Member Function Documentation

◆ accept()

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.

◆ getAcceptedBufferedStream()

BufferedStream* hu::varadiistvan::scpl::io::LocalAcceptor::getAcceptedBufferedStream ( Waiter waiter = nullptr)
overridevirtual

Get the last accepted socket with the given waiter, if any.

Implements hu::varadiistvan::scpl::io::BufferedStreamAcceptor.

◆ getSocket() [1/2]

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.

◆ getSocket() [2/2]

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.


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