OpenTTD Source
20241121-master-g67a0fccfad
|
OS specific implementations of functions of the OS abstraction layer for network stuff. More...
#include "stdafx.h"
#include "os_abstraction.h"
#include "../../string_func.h"
#include "../../3rdparty/fmt/format.h"
#include <mutex>
#include "../../safeguards.h"
Go to the source code of this file.
Functions | |
bool | SetNonBlocking ([[maybe_unused]] SOCKET d) |
Try to set the socket into non-blocking mode. More... | |
bool | SetNoDelay ([[maybe_unused]] SOCKET d) |
Try to set the socket to not delay sending. More... | |
bool | SetReusePort (SOCKET d) |
Try to set the socket to reuse ports. More... | |
NetworkError | GetSocketError (SOCKET d) |
Get the error from a socket, if any. More... | |
OS specific implementations of functions of the OS abstraction layer for network stuff.
The general idea is to have simple abstracting functions for things that require different implementations for different environments. In here the functions, and their documentation, are defined only once and the implementation contains the #ifdefs to change the implementation. Since Windows is usually different that is usually the first case, after that the behaviour is usually Unix/BSD-like with occasional variation.
Definition in file os_abstraction.cpp.
NetworkError GetSocketError | ( | SOCKET | d | ) |
Get the error from a socket, if any.
d | The socket to get the error from. |
Definition at line 184 of file os_abstraction.cpp.
Referenced by TCPConnecter::CheckActivity().
bool SetNoDelay | ( | [[maybe_unused] ] SOCKET | d | ) |
Try to set the socket to not delay sending.
d | The socket to disable the delaying for. |
Definition at line 151 of file os_abstraction.cpp.
Referenced by TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::AcceptClient(), TCPConnecter::Connect(), and ListenLoopProc().
bool SetNonBlocking | ( | [[maybe_unused] ] SOCKET | d | ) |
Try to set the socket into non-blocking mode.
d | The socket to set the non-blocking more for. |
Definition at line 133 of file os_abstraction.cpp.
Referenced by TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::AcceptClient(), TCPConnecter::Connect(), ListenLoopProc(), and NetworkUDPSocketHandler::ReceivePackets().
bool SetReusePort | ( | SOCKET | d | ) |
Try to set the socket to reuse ports.
d | The socket to reuse ports on. |
Definition at line 167 of file os_abstraction.cpp.
Referenced by TCPConnecter::Connect(), and ListenLoopProc().