SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::platform Namespace Reference

Platform abstraction layer. More...

Typedefs

typedef int SocketHandle

Functions

bool initializeNetwork ()
 Initialize network subsystem (Windows only)
void cleanupNetwork ()
 Cleanup network subsystem (Windows only)
SocketHandle createServerSocket (const std::string &host, uint16_t port)
 Create server socket.
void closeSocket (SocketHandle sock)
 Close socket.
bool setSocketNonBlocking (SocketHandle sock)
 Set socket non-blocking.
std::string getClientIpFromSocket (SocketHandle sock)
 Get client IP from socket.
SocketHandle acceptConnection (SocketHandle serverSocket)
 Accept a connection on a socket.

Detailed Description

Platform abstraction layer.

This namespace contains cross-platform wrappers for operating system functionality, allowing the code to work seamlessly on Windows, Linux, macOS, and other POSIX systems.

Platform abstraction layer This namespace contains cross-platform wrappers for operating system functionality, allowing the code to work seamlessly on Windows, Linux, macOS, and other POSIX systems.

Function Documentation

◆ acceptConnection()

SocketHandle svcs::platform::acceptConnection ( SocketHandle serverSocket)

Accept a connection on a socket.

Parameters
serverSocketServer socket handle
Returns
Client socket handle or INVALID_SOCKET_HANDLE on error

◆ closeSocket()

void svcs::platform::closeSocket ( SocketHandle sock)

Close socket.

Parameters
sockSocket handle to close

◆ createServerSocket()

SocketHandle svcs::platform::createServerSocket ( const std::string & host,
uint16_t port )

Create server socket.

Parameters
hostHost address to bind to (empty string for any)
portPort to bind to
Returns
Socket handle or INVALID_SOCKET_HANDLE on error

◆ getClientIpFromSocket()

std::string svcs::platform::getClientIpFromSocket ( SocketHandle sock)

Get client IP from socket.

Parameters
sockSocket handle
Returns
Client IP address as string

◆ initializeNetwork()

bool svcs::platform::initializeNetwork ( )

Initialize network subsystem (Windows only)

Returns
true if successful, false otherwise

◆ setSocketNonBlocking()

bool svcs::platform::setSocketNonBlocking ( SocketHandle sock)

Set socket non-blocking.

Parameters
sockSocket handle
Returns
true if successful, false otherwise