jsocketpp 1.0
A cross-platform C++20 socket library.
Loading...
Searching...
No Matches
SocketInitializer.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "SocketException.h"
9#include "common.hpp"
10
11namespace jsocketpp
12{
20{
21 public:
31
37 {
38 if (CleanupSockets() != 0)
39 std::cerr << "Socket cleanup failed: " << SocketErrorMessageWrap(GetSocketError()) << ": "
40 << GetSocketError() << std::endl;
41 }
42
47
52};
53
54} // namespace jsocketpp
Represents socket-related errors in the jsocketpp library.
Definition SocketException.hpp:58
SocketInitializer & operator=(const SocketInitializer &rhs)=delete
Deleted copy assignment operator (non-copyable).
SocketInitializer()
Initialize socket system (WSAStartup on Windows).
Definition SocketInitializer.hpp:26
SocketInitializer(const SocketInitializer &rhs)=delete
Deleted copy constructor (non-copyable).
~SocketInitializer() noexcept
Clean up socket system (WSACleanup on Windows).
Definition SocketInitializer.hpp:36
Common platform and utility includes for jsocketpp.
A C++ socket library providing Java-style networking interfaces.
Definition BufferView.hpp:13
int CleanupSockets()
Definition common.hpp:197
std::string SocketErrorMessage(int error, bool gaiStrerror=false)
Returns a human-readable error message for a socket error code.
Definition common.cpp:5
std::string SocketErrorMessageWrap(int error, bool gaiStrerror=false)
Returns a human-readable error message for a socket error code, with exception safety.
Definition common.cpp:50
int GetSocketError()
Definition common.hpp:202
int InitSockets()
Definition common.hpp:191