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

A network socket. More...

#include <gf/Socket.h>

Inheritance diagram for gf::Socket:
Inheritance graph
[legend]

Public Member Functions

 ~Socket ()
 Destructor. More...
 
 Socket (const Socket &)=delete
 Deleted copy constructor. More...
 
Socketoperator= (const Socket &)=delete
 Deleted copy assignment. More...
 
 Socket (Socket &&other) noexcept
 Move constructor. More...
 
Socketoperator= (Socket &&other) noexcept
 Move assignment. More...
 
 operator bool () const noexcept
 Boolean conversion. More...
 
SocketAddress getLocalAddress () const
 Get the local address of the socket. More...
 
void setBlocking ()
 Set the socket in blocking mode. More...
 
void setNonBlocking ()
 Set the socket in non-blocking mode. More...
 

Detailed Description

A network socket.

See also
gf::TcpListener, gf::TcpSocket, gf::UdpSocket

Constructor & Destructor Documentation

◆ ~Socket()

gf::Socket::~Socket ( )

Destructor.

The socket is closed.

◆ Socket() [1/2]

gf::Socket::Socket ( const Socket )
delete

Deleted copy constructor.

◆ Socket() [2/2]

gf::Socket::Socket ( Socket &&  other)
noexcept

Move constructor.

Parameters
otherThe socket from which to move the socket handle

Member Function Documentation

◆ getLocalAddress()

SocketAddress gf::Socket::getLocalAddress ( ) const

Get the local address of the socket.

Returns
The local address of the socket

◆ operator bool()

gf::Socket::operator bool ( ) const
inlinenoexcept

Boolean conversion.

Returns
True if the socket is valid

◆ operator=() [1/2]

Socket& gf::Socket::operator= ( const Socket )
delete

Deleted copy assignment.

◆ operator=() [2/2]

Socket& gf::Socket::operator= ( Socket &&  other)
noexcept

Move assignment.

Parameters
otherThe socket from which to move the socket handle
Returns
A reference to the socket

◆ setBlocking()

void gf::Socket::setBlocking ( )

Set the socket in blocking mode.

See also
setNonBlocking()

◆ setNonBlocking()

void gf::Socket::setNonBlocking ( )

Set the socket in non-blocking mode.

See also
setBlocking()