5#ifdef USE_SOCKET_IMPL_LWIP_SOCKETS
14 if (!monitor_loop || this->
fd_ < 0)
16#ifdef USE_LWIP_FAST_SELECT
34#ifdef USE_LWIP_FAST_SELECT
44 int ret = lwip_close(this->
fd_);
52 int fl = lwip_fcntl(this->
fd_, F_GETFL, 0);
58 lwip_fcntl(this->
fd_, F_SETFL, fl);
83static std::unique_ptr<LwIPSocketImpl> create_socket(
int domain,
int type,
int protocol,
bool loop_monitored =
false) {
84 int ret = lwip_socket(domain,
type, protocol);
87 return make_unique<LwIPSocketImpl>(ret, loop_monitored);
90std::unique_ptr<Socket> socket(
int domain,
int type,
int protocol) {
91 return create_socket(domain,
type, protocol,
false);
95 return create_socket(domain,
type, protocol,
true);
bool register_socket(struct lwip_sock *sock)
Register/unregister a socket to be monitored for read events.
void unregister_socket_fd(int fd)
bool register_socket_fd(int fd)
Fallback select() path: monitors file descriptors.
void unregister_socket(struct lwip_sock *sock)
int setblocking(bool blocking)
int getsockname(struct sockaddr *addr, socklen_t *addrlen)
size_t getsockname_to(std::span< char, SOCKADDR_STR_LEN > buf)
Format local address into a fixed-size buffer (no heap allocation)
struct lwip_sock * cached_sock_
LwIPSocketImpl(int fd, bool monitor_loop=false)
int getpeername(struct sockaddr *addr, socklen_t *addrlen)
size_t getpeername_to(std::span< char, SOCKADDR_STR_LEN > buf)
Format peer address into a fixed-size buffer (no heap allocation)
struct lwip_sock * esphome_lwip_get_sock(int fd)
Look up a LwIP socket struct from a file descriptor.
size_t format_sockaddr_to(const struct sockaddr *addr_ptr, socklen_t len, std::span< char, SOCKADDR_STR_LEN > buf)
Format sockaddr into caller-provided buffer, returns length written (excluding null)
std::unique_ptr< Socket > socket_loop_monitored(int domain, int type, int protocol)
Create a socket and monitor it for data in the main loop.
Application App
Global storage of Application pointer - only one Application can exist.