ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
toy::network Namespace Reference

Network types: endpoint, socket error, flags, statistics, type, and related APIs. More...

Classes

class  Endpoint
 Abstract base for a network endpoint (hostname and port). More...
struct  SocketStatistics
 Byte counters for socket traffic (sent and received). More...

Enumerations

enum class  SocketError {
  None , InvalidOperation , IOError , InvalidAddress ,
  AddressInUse , SocketInvalid , WouldBlock , Timeout ,
  MemoryError , SystemError
}
 Error codes for socket and network operations. More...
enum class  SocketFlags : uint8_t {
  None = 0x00 , NonBlocking = 0x01 , ReuseAddress = 0x02 , Broadcast = 0x04 ,
  Listen = 0x08 , Bind = 0x10
}
 Bitmask flags for socket options and operating mode. More...
enum class  SocketType : uint8_t { Datagram , Stream , Dummy }
 Kind of socket or socket-like endpoint. More...

Detailed Description

Network types: endpoint, socket error, flags, statistics, type, and related APIs.

See also
toy::network::Endpoint, toy::network::SocketError, toy::network::SocketFlags, toy::network::SocketStatistics, toy::network::SocketType

Enumeration Type Documentation

◆ SocketError

enum class toy::network::SocketError
strong

Error codes for socket and network operations.

Returned by socket APIs to indicate failure reason. Use for error handling and diagnostics.

Enumerator
None 

No error; operation succeeded.

InvalidOperation 

Operation not allowed in current state (e.g. send on closed socket).

IOError 

I/O failure during read or write.

InvalidAddress 

Invalid or unsupported address format.

AddressInUse 

Address or port already in use.

SocketInvalid 

Socket handle is invalid or closed.

WouldBlock 

Operation would block (non-blocking mode).

Timeout 

Operation timed out.

MemoryError 

Memory allocation failed.

SystemError 

Platform-specific system error.

◆ SocketFlags

enum class toy::network::SocketFlags : uint8_t
strong

Bitmask flags for socket options and operating mode.

Values can be combined (e.g. NonBlocking | ReuseAddress). Interpretation is platform-dependent; maps to socket options and flags such as O_NONBLOCK, SO_REUSEADDR.

Enumerator
None 

No flags set.

NonBlocking 

Socket operates in non-blocking mode.

ReuseAddress 

Allow local address reuse (e.g. SO_REUSEADDR).

Broadcast 

Enable broadcast send/receive.

Listen 

Socket is in listen state (for accepting connections).

Bind 

Socket is bound to a local address.

◆ SocketType

enum class toy::network::SocketType : uint8_t
strong

Kind of socket or socket-like endpoint.

Used to distinguish datagram (UDP-style) vs stream (TCP-style) sockets. toy::network::SocketType::Dummy is for tests or stubs that do not perform real I/O.

Enumerator
Datagram 

Datagram socket (e.g. UDP); message-oriented, unreliable.

Stream 

Stream socket (e.g. TCP); connection-oriented, reliable byte stream.

Dummy 

Dummy socket for tests or stubs; no real network I/O.