1234567891011121314151617181920212223242526272829 |
- #ifndef SOCKET_H
- #define SOCKET_H
- #include "common/utils/Types.h"
- enum WaitResult {
- TIMEOUT, SUCCESS, ERROR
- };
- class Socket final {
- public:
- Socket();
- ~Socket();
- Socket(const Socket& other) = delete;
- Socket& operator=(const Socket& other) = delete;
- Socket(Socket&& other) = delete;
- Socket& operator=(Socket&& other) = delete;
-
- bool hasError() const;
- bool setNonLinger();
- bool listenOnPort(u16 port, uint queueLength) const;
- WaitResult waitForConnection(uint timeoutMillis) const;
- int acceptConnection() const;
- private:
- int socketId;
- };
- #endif
|