Function accept
Synopsis
#include <src/uvw/stream.h>
template <typename S>
void accept(S &ref)
Description
Accepts incoming connections.
This call is used in conjunction with listen()
to accept incoming connections. Call this function after receiving a ListenEvent event to accept the connection. Before calling this function, the submitted handle must be initialized.
An ErrorEvent event will be emitted in case of errors.
When the ListenEvent event is emitted it is guaranteed that this function will complete successfully the first time. If you attempt to use it more than once, it may fail.
It is suggested to only call this function once per ListenEvent event.
- Note
- Both the handles must be running on the same loop.
- Parameters
ref
- An initialized handle to be used to accept the connection.
Mentioned in
- Getting Started / Code Example
- Getting Started / The event-based approach
Source
Lines 218-221 in src/uvw/stream.h.
template<typename S>
void accept(S &ref) {
this->invoke(&uv_accept, this->template get<uv_stream_t>(), this->template get<uv_stream_t>(ref));
}