OpenJPH
Open-source implementation of JPEG2000 Part-15
ojph::net::socket Class Reference

A small wrapper for socket that only abstract Winsock2. More...

#include <ojph_sockets.h>

Public Member Functions

 socket ()
 default constructor More...
 
 socket (const ojph_socket &s)
 a copy constructor More...
 
void close ()
 Abstracts socket closing function. More...
 
bool set_blocking_mode (bool block)
 Sets the blocking mode. More...
 
ojph_socket intern ()
 provides access to the internal socket handle More...
 

Private Attributes

ojph_socket s
 int for Linux/MacOS and SOCKET for Windows More...
 

Detailed Description

A small wrapper for socket that only abstract Winsock2.

This is a small wrapper that only abstracts the difference between Windows and Linux/MacOS socket implementations. It does not not do much other than define a local member variable of type int for Linux/OS and type SOCKET for Windows, which is unsigned int/int64.

Definition at line 88 of file ojph_sockets.h.

Constructor & Destructor Documentation

◆ socket() [1/2]

ojph::net::socket::socket ( )
inline

default constructor

Definition at line 93 of file ojph_sockets.h.

References OJPH_INVALID_SOCKET, and s.

◆ socket() [2/2]

ojph::net::socket::socket ( const ojph_socket s)

a copy constructor

Definition at line 57 of file ojph_sockets.cpp.

References s.

Member Function Documentation

◆ close()

void ojph::net::socket::close ( )

Abstracts socket closing function.

Definition at line 63 of file ojph_sockets.cpp.

References close(), OJPH_INVALID_SOCKET, and s.

Referenced by close(), and main().

◆ intern()

ojph_socket ojph::net::socket::intern ( )
inline

provides access to the internal socket handle

Returns
returns the internal socket handle

Definition at line 118 of file ojph_sockets.h.

References s.

Referenced by main().

◆ set_blocking_mode()

bool ojph::net::socket::set_blocking_mode ( bool  block)

Sets the blocking mode.

Parameters
blocksets to true to operate in blocking mode
Returns
returns true when the operation succeeds

Definition at line 78 of file ojph_sockets.cpp.

References s.

Referenced by main().

Member Data Documentation

◆ s

ojph_socket ojph::net::socket::s
private

int for Linux/MacOS and SOCKET for Windows

Definition at line 121 of file ojph_sockets.h.

Referenced by close(), intern(), set_blocking_mode(), and socket().


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