Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
Socket.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace orbit::network {
6
7class Socket {
8public:
9 // Create a new socket
11
12 // Wrap an existing socket file descriptor
13 explicit Socket(socket_t fd);
14
15 // Destructor: Closes the socket to prevent leaks (RAII)
17
18 // Delete copy semantics to prevent double-closing
19 Socket(const Socket&) = delete;
20 Socket& operator=(const Socket&) = delete;
21
22 // Allow move semantics
23 Socket(Socket&& other) noexcept;
24 Socket& operator=(Socket&& other) noexcept;
25
26 socket_t fd() const;
27 bool is_valid() const;
28 void close();
29
30 // Convert socket to non-blocking mode
32
33private:
35};
36
37} // namespace network
Definition Socket.hpp:7
Socket & operator=(Socket &&other) noexcept
socket_t fd() const
Socket(Socket &&other) noexcept
Socket & operator=(const Socket &)=delete
socket_t fd_
Definition Socket.hpp:34
Socket(const Socket &)=delete
Definition Http2Session.hpp:21
int socket_t
Definition PlatformSocket.hpp:39