Gamedev Framework (gf)  0.17.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::SocketAddress Class Reference

A socket address. More...

#include <gf/SocketAddress.h>

Public Member Functions

 SocketAddress ()=default
 Default constructor. More...
 
SocketFamily getFamily () const
 Get the family of the socket address. More...
 
std::string getHostname (SocketAddressFormat format=SocketAddressFormat::Unrestricted) const
 Get the hostname associated to the address. More...
 
std::string getService (SocketAddressFormat format=SocketAddressFormat::Unrestricted) const
 Get the service associated to the address. More...
 

Detailed Description

A socket address.

A socket address is composed of an IP address (representing an hostname) and a port number (representing a service).

You can not create a socket address directly.

In other libraries, it can also be called "endpoint".

Constructor & Destructor Documentation

◆ SocketAddress()

gf::SocketAddress::SocketAddress ( )
default

Default constructor.

Member Function Documentation

◆ getFamily()

SocketFamily gf::SocketAddress::getFamily ( ) const

Get the family of the socket address.

◆ getHostname()

std::string gf::SocketAddress::getHostname ( SocketAddressFormat  format = SocketAddressFormat::Unrestricted) const

Get the hostname associated to the address.

Parameters
formatThe format of the socket address
Returns
The hostname part of the address as a string
See also
getService()

◆ getService()

std::string gf::SocketAddress::getService ( SocketAddressFormat  format = SocketAddressFormat::Unrestricted) const

Get the service associated to the address.

Parameters
formatThe format of the socket address
Returns
The service part of the address as a string
See also
getHostname()