10Duke Enterprise C++ SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
Socket.h
1
#ifndef TENDUKE_OSA_SOCKET_H
2
#define TENDUKE_OSA_SOCKET_H
3
4
#include <cstdint>
5
#include <memory>
6
7
namespace
tenduke
{
namespace
osa
{
8
13
class
Socket
14
{
15
public
:
16
virtual
~Socket
() =
default
;
17
29
virtual
std::unique_ptr<Socket>
accept
(uint32_t timeoutMs) = 0;
30
36
virtual
std::unique_ptr<Socket>
accept
() = 0;
37
43
virtual
void
bind
(
44
std::uint32_t ipAddress,
45
std::uint16_t port
46
) = 0;
47
52
virtual
void
listen
() = 0;
53
61
virtual
int
read
(
void
* buffer, std::size_t bufferSize) = 0;
62
70
virtual
int
write
(
const
void
* buffer, std::size_t len) = 0;
71
76
virtual
std::uint16_t
getPort
()
const
= 0;
77
82
virtual
void
setNonBlocking
() = 0;
83
};
84
85
}}
86
87
#endif
//TENDUKE_OSA_SOCKET_H
tenduke::osa::Socket
OS-independent abstraction of a socket.
Definition
Socket.h:14
tenduke::osa::Socket::write
virtual int write(const void *buffer, std::size_t len)=0
Write bytes to the socket.
tenduke::osa::Socket::bind
virtual void bind(std::uint32_t ipAddress, std::uint16_t port)=0
Binds the socket.
tenduke::osa::Socket::read
virtual int read(void *buffer, std::size_t bufferSize)=0
Reads bytes from the socket.
tenduke::osa::Socket::setNonBlocking
virtual void setNonBlocking()=0
Sets the socket to non-blocking mode.
tenduke::osa::Socket::accept
virtual std::unique_ptr< Socket > accept()=0
Accepts next connection from listening socket.
tenduke::osa::Socket::accept
virtual std::unique_ptr< Socket > accept(uint32_t timeoutMs)=0
Accepts next connection from listening socket, with a timeout.
tenduke::osa::Socket::getPort
virtual std::uint16_t getPort() const =0
Returns port of the socket.
tenduke::osa::Socket::listen
virtual void listen()=0
Configures the socket to listen for incoming connections.
tenduke::osa
Operating system abstraction.
Definition
win32_utils.h:7
tenduke
Root for classes, functions and globals of 10Duke C++ Client.
Definition
APIRequest.h:4
core
oidc
osbrowser
src
osa
Socket.h
Generated by
1.17.0