Loading...
Searching...
No Matches
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
| socket (const ojph_socket &s)
| a copy constructor
void | close ()
| Abstracts socket closing function.
bool | set_blocking_mode (bool block)
| Sets the blocking mode.
ojph_socket | intern ()
| provides access to the internal socket handle

## Private Attributes

ojph_socket | s
| int for Linux/MacOS and SOCKET for Windows

## 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

  block | sets 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(), socket(), and socket().

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

- /build/openjph-z1hyMm/openjph-0.28.1/src/apps/common/ojph_sockets.h
- /build/openjph-z1hyMm/openjph-0.28.1/src/apps/others/ojph_sockets.cpp