OpenTTD Source: src/network/core/os_abstraction.h File Reference

OpenTTD Source 15.3

Data Structures | Functions
os_abstraction.h File Reference

Network stuff has many things that needs to be included and/or implemented by default. More...

Go to the source code of this file.

## Data Structures
class | NetworkError
| Abstraction of a network error where all implementation details of the error codes are encapsulated in this class and the abstraction layer. More...
struct | SocketSender
| IPv4 addresses should be 4 bytes. More...
struct | SocketReceiver

## Functions
bool | SetNonBlocking (SOCKET d)
| Try to set the socket into non-blocking mode.
bool | SetNoDelay (SOCKET d)
| Try to set the socket to not delay sending.
bool | SetReusePort (SOCKET d)
| Try to set the socket to reuse ports.
NetworkError | GetSocketError (SOCKET d)
| Get the error from a socket, if any.

## Detailed Description

Network stuff has many things that needs to be included and/or implemented by default.

All those things are in this file.

Definition in file os_abstraction.h.

## Function Documentation

## ◆ GetSocketError()

NetworkError GetSocketError | ( | SOCKET | d | ) |

Get the error from a socket, if any.

Parameters

  d | The socket to get the error from.

Returns
  The errno on the socket.

Definition at line 185 of file os_abstraction.cpp.

Referenced by TCPConnecter::CheckActivity().

## ◆ SetNoDelay()

bool SetNoDelay | ( | SOCKET | d | ) |

Try to set the socket to not delay sending.

Parameters

  d | The socket to disable the delaying for.

Returns
  True if disabling the delaying succeeded, otherwise false.

Definition at line 152 of file os_abstraction.cpp.

Referenced by TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::AcceptClient(), TCPConnecter::Connect(), and ListenLoopProc().

## ◆ SetNonBlocking()

bool SetNonBlocking | ( | SOCKET | d | ) |

Try to set the socket into non-blocking mode.

Parameters

  d | The socket to set the non-blocking more for.

Returns
  True if setting the non-blocking mode succeeded, otherwise false.

Definition at line 134 of file os_abstraction.cpp.

Referenced by TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::AcceptClient(), TCPConnecter::Connect(), ListenLoopProc(), and NetworkUDPSocketHandler::ReceivePackets().

## ◆ SetReusePort()

bool SetReusePort | ( | SOCKET | d | ) |

Try to set the socket to reuse ports.

Parameters

  d | The socket to reuse ports on.

Returns
  True if disabling the delaying succeeded, otherwise false.

Definition at line 168 of file os_abstraction.cpp.

Referenced by TCPConnecter::Connect(), and ListenLoopProc().