EasySockets v2.0.0
A simple, cross platform socket library for C++.
Loading...
Searching...
No Matches
Cross-Platform API

Classes

struct  es::EndPoint
 Represents the address + port that identifies a connection. Initialized by {Address, Port}, e.g. {"192.168.0.1", 443}. More...

Typedefs

using es::Address = std::string
 String IP address.
using es::Port = uint16_t
 16-bit port number.
using es::Socket = WindowsSocket
 An object which represents a connection between two applications.
using es::Context = WinsockContext
 An object which is required to exist for es::Sockets to be used.

Enumerations

enum class  es::IpVersion { es::IpVersion::IPV4 , es::IpVersion::IPV6 , es::IpVersion::DUAL_STACK }
 Version of IP address. More...
enum class  es::Protocol { es::Protocol::TCP , es::Protocol::UDP }
 Layer 4/transport layer protocol. More...

Typedef Documentation

◆ Address

using es::Address = std::string

String IP address.

◆ Context

An object which is required to exist for es::Sockets to be used.

Note
Type alias depends on the platform, but API is the same regardless of platform.
See also
es::WinsockContext
es::PosixContext

This ensures that any underlying setup and cleanup code is called.
For example: es::Context context{}; // must be created before any sockets are created es::Socket socket{es::IpVersion::ipv4, es::Protocol::tcp}; socket.bind({"0.0.0.0", 8080});
Can be moved from but not copied. Members are the same across all implementations.

◆ Port

using es::Port = uint16_t

16-bit port number.

◆ Socket

An object which represents a connection between two applications.

Note
Type alias depends on the platform, but API is the same regardless of platform.
See also
es::WindowsSocket
es::PosixSocket

On creation, type of ip addresses that the socket will use and the layer 4/transport layer protocol is specified.
From this, methods like .bind_to(EndPoint end_point) and .connect_to(EndPoint end_point) to give the socket an address and port so that it can start communicating with other applications.
For connectionless protocols like UDP, data can be sent and received without binding or connecting first.
Can be moved from but not copied. Members are the same across all implementations.

Enumeration Type Documentation

◆ IpVersion

enum class es::IpVersion
strong

Version of IP address.

Enumerator
IPV4 

An IPv4 address.

IPV6 

An Ipv6 address.

DUAL_STACK 

An IPv6 address which allows for conversions from IPv4.

◆ Protocol

enum class es::Protocol
strong

Layer 4/transport layer protocol.

Enumerator
TCP 

TCP protocol.

UDP 

UDP protocol.