diff options
Diffstat (limited to 'dev/lib/net/modem.hpp')
| -rw-r--r-- | dev/lib/net/modem.hpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/dev/lib/net/modem.hpp b/dev/lib/net/modem.hpp index 074f182..69b1aef 100644 --- a/dev/lib/net/modem.hpp +++ b/dev/lib/net/modem.hpp @@ -5,19 +5,18 @@ * Copyright 2025, Amlal El Mahrouss */ -#ifndef _OCL_NET_NETWORK_HPP -#define _OCL_NET_NETWORK_HPP +#ifndef _SCL_NET_NETWORK_HPP +#define _SCL_NET_NETWORK_HPP #include <unistd.h> #include <arpa/inet.h> #include <sys/socket.h> #include <string> -#include <utility> #include <cstddef> -#define OCL_MODEM_INTERFACE : public ocl::net::basic_modem +#define OCL_MODEM_INTERFACE : public scl::net::basic_modem -namespace ocl::net +namespace scl::net { class basic_modem; @@ -130,12 +129,13 @@ namespace ocl::net return ret == 0L; } - ::bind(fd_, (struct sockaddr*)&addr_, sizeof(addr_)); - ::listen(fd_, basic_modem::backlog_count); + int ret = ::bind(fd_, (struct sockaddr*)&addr_, sizeof(addr_)); - bad_ = false; + bad_ = ret == -1; + + ::listen(fd_, basic_modem::backlog_count); - return true; + return bad_ == false; } bool destroy() noexcept @@ -151,6 +151,6 @@ namespace ocl::net return true; } }; -} // namespace ocl::net +} // namespace scl::net -#endif // ifndef _OCL_NET_NETWORK_HPP +#endif // ifndef _SCL_NET_NETWORK_HPP |
