Jetpack documentation 1.0.0
Loading...
Searching...
No Matches
Socket Class Reference

An encapsulation of the socket file descriptor. More...

#include <Socket.hpp>

Public Member Functions

 Socket (int domain, int type, int protocol)
 Constructor for Socket class.
 
 Socket (int sockfd=-1)
 Constructor for Socket class.
 
 ~Socket ()
 Deleted copy constructor.
 
int getSocket () const
 Gets the socket file descriptor.
 
void operator() (int sockfd)
 Sets the socket file descriptor.
 
void operator= (int sockfd)
 Sets the socket file descriptor.
 
bool operator== (int sockfd) const
 Compares the socket file descriptor.
 

Private Attributes

int _sockfd
 

Detailed Description

An encapsulation of the socket file descriptor.

Constructor & Destructor Documentation

◆ Socket() [1/2]

Socket ( int domain,
int type,
int protocol )

Constructor for Socket class.

Parameters
domainThe domain of the socket
typeThe type of the socket
protocolThe protocol of the socket
Exceptions
JetpackErrorIf the socket creation fails

◆ Socket() [2/2]

Socket ( int sockfd = -1)

Constructor for Socket class.

Parameters
sockfdThe socket file descriptor

◆ ~Socket()

~Socket ( )

Deleted copy constructor.

Parameters
otherThe other Socket object to copy from

Member Function Documentation

◆ getSocket()

int getSocket ( ) const

Gets the socket file descriptor.

Returns
The socket file descriptor

◆ operator()()

void operator() ( int sockfd)

Sets the socket file descriptor.

Parameters
sockfdThe socket file descriptor

◆ operator=()

void operator= ( int sockfd)

Sets the socket file descriptor.

Parameters
sockfdThe socket file descriptor

◆ operator==()

bool operator== ( int sockfd) const

Compares the socket file descriptor.

Parameters
sockfdThe socket file descriptor
Returns
True if the socket file descriptor is equal to the current one and False if the socket file descriptor is not equal to the current one

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