join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicSocketStream< Protocol > Class Template Reference

socket stream class. More...

#include <socketstream.hpp>

Inheritance diagram for join::BasicSocketStream< Protocol >:
Collaboration diagram for join::BasicSocketStream< Protocol >:

Public Types

using SocketStreambuf = BasicSocketStreambuf <Protocol>
 
using Endpoint = typename Protocol::Endpoint
 
using Socket = typename Protocol::Socket
 

Public Member Functions

 BasicSocketStream ()
 default constructor.
 
 BasicSocketStream (const BasicSocketStream &other)=delete
 copy constructor.
 
BasicSocketStreamoperator= (const BasicSocketStream &other)=delete
 copy assignment operator.
 
 BasicSocketStream (BasicSocketStream &&other)
 move constructor.
 
BasicSocketStreamoperator= (BasicSocketStream &&other)
 move assignment operator.
 
virtual ~BasicSocketStream ()=default
 destroy the socket stream instance.
 
virtual void bind (const Endpoint &endpoint)
 assigns the specified endpoint to the socket.
 
virtual void connect (const Endpoint &endpoint)
 make a connection to the given endpoint.
 
virtual void disconnect ()
 shutdown the connection.
 
virtual void close ()
 close the connection.
 
Endpoint localEndpoint ()
 determine the local endpoint associated with this socket.
 
const EndpointremoteEndpoint ()
 determine the remote endpoint associated with this socket.
 
bool opened ()
 check if the socket is opened.
 
bool connected ()
 check if the socket is connected.
 
bool encrypted ()
 check if the socket is secure.
 
void timeout (int ms)
 set the socket timeout.
 
int timeout () const
 get the current timeout in milliseconds.
 
Socketsocket ()
 get the nested socket.
 

Protected Attributes

SocketStreambuf _sockbuf
 associated stream buffer.
 

Detailed Description

template<class Protocol>
class join::BasicSocketStream< Protocol >

socket stream class.

Member Typedef Documentation

◆ Endpoint

template<class Protocol >
using join::BasicSocketStream< Protocol >::Endpoint = typename Protocol::Endpoint

◆ Socket

template<class Protocol >
using join::BasicSocketStream< Protocol >::Socket = typename Protocol::Socket

◆ SocketStreambuf

template<class Protocol >
using join::BasicSocketStream< Protocol >::SocketStreambuf = BasicSocketStreambuf <Protocol>

Constructor & Destructor Documentation

◆ BasicSocketStream() [1/3]

template<class Protocol >
join::BasicSocketStream< Protocol >::BasicSocketStream ( )
inline

default constructor.

◆ BasicSocketStream() [2/3]

template<class Protocol >
join::BasicSocketStream< Protocol >::BasicSocketStream ( const BasicSocketStream< Protocol > & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ BasicSocketStream() [3/3]

template<class Protocol >
join::BasicSocketStream< Protocol >::BasicSocketStream ( BasicSocketStream< Protocol > && other)
inline

move constructor.

Parameters
otherother object to move.

◆ ~BasicSocketStream()

template<class Protocol >
virtual join::BasicSocketStream< Protocol >::~BasicSocketStream ( )
virtualdefault

destroy the socket stream instance.

Member Function Documentation

◆ bind()

template<class Protocol >
virtual void join::BasicSocketStream< Protocol >::bind ( const Endpoint & endpoint)
inlinevirtual

assigns the specified endpoint to the socket.

Parameters
endpointendpoint to assign to the socket.
Exceptions
std::ios_base::failure.

◆ close()

template<class Protocol >
virtual void join::BasicSocketStream< Protocol >::close ( )
inlinevirtual

close the connection.

Exceptions
std::ios_base::failure.

◆ connect()

template<class Protocol >
virtual void join::BasicSocketStream< Protocol >::connect ( const Endpoint & endpoint)
inlinevirtual

make a connection to the given endpoint.

Parameters
endpointendpoint to connect to.
Exceptions
std::ios_base::failure.

◆ connected()

template<class Protocol >
bool join::BasicSocketStream< Protocol >::connected ( )
inline

check if the socket is connected.

Returns
true if connected, false otherwise.

◆ disconnect()

template<class Protocol >
virtual void join::BasicSocketStream< Protocol >::disconnect ( )
inlinevirtual

shutdown the connection.

Exceptions
std::ios_base::failure.

◆ encrypted()

template<class Protocol >
bool join::BasicSocketStream< Protocol >::encrypted ( )
inline

check if the socket is secure.

Returns
true if the socket is secure, false otherwise.

◆ localEndpoint()

template<class Protocol >
Endpoint join::BasicSocketStream< Protocol >::localEndpoint ( )
inline

determine the local endpoint associated with this socket.

Returns
local endpoint.

◆ opened()

template<class Protocol >
bool join::BasicSocketStream< Protocol >::opened ( )
inline

check if the socket is opened.

Returns
true if opened, false otherwise.

◆ operator=() [1/2]

template<class Protocol >
BasicSocketStream & join::BasicSocketStream< Protocol >::operator= ( BasicSocketStream< Protocol > && other)
inline

move assignment operator.

Parameters
otherother object to assign.
Returns
current object.

◆ operator=() [2/2]

template<class Protocol >
BasicSocketStream & join::BasicSocketStream< Protocol >::operator= ( const BasicSocketStream< Protocol > & other)
delete

copy assignment operator.

Parameters
otherother object to assign.
Returns
current object.

◆ remoteEndpoint()

template<class Protocol >
const Endpoint & join::BasicSocketStream< Protocol >::remoteEndpoint ( )
inline

determine the remote endpoint associated with this socket.

Returns
remote endpoint.

◆ socket()

template<class Protocol >
Socket & join::BasicSocketStream< Protocol >::socket ( )
inline

get the nested socket.

Returns
the nested socket.

◆ timeout() [1/2]

template<class Protocol >
int join::BasicSocketStream< Protocol >::timeout ( ) const
inline

get the current timeout in milliseconds.

Returns
the current timeout.

◆ timeout() [2/2]

template<class Protocol >
void join::BasicSocketStream< Protocol >::timeout ( int ms)
inline

set the socket timeout.

Parameters
mstimeout in milliseconds.

Member Data Documentation

◆ _sockbuf

template<class Protocol >
SocketStreambuf join::BasicSocketStream< Protocol >::_sockbuf
protected

associated stream buffer.


The documentation for this class was generated from the following files: