SVCS - English Documentation
Loading...
Searching...
No Matches
NetworkUtils.hxx File Reference

Cross-platform network utilities. More...

#include <string>
#include <cstdint>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>

Go to the source code of this file.

Namespaces

namespace  svcs::platform
 Platform abstraction layer.

Macros

#define INVALID_SOCKET_HANDLE   (-1)
#define SOCKET_ERROR_CODE   errno

Typedefs

typedef int svcs::platform::SocketHandle

Functions

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

Detailed Description

Cross-platform network utilities.