proxygen
folly::NetworkSocket Struct Reference

#include <NetworkSocket.h>

Public Types

using native_handle_type = int
 

Public Member Functions

constexpr NetworkSocket ()
 
constexpr NetworkSocket (native_handle_type d)
 
int toFd () const
 

Static Public Member Functions

static NetworkSocket fromFd (int fd)
 

Public Attributes

native_handle_type data
 

Static Public Attributes

static constexpr native_handle_type invalid_handle_value = -1
 

Friends

constexpr bool operator== (const NetworkSocket &a, const NetworkSocket &b) noexcept
 
constexpr bool operator!= (const NetworkSocket &a, const NetworkSocket &b) noexcept
 

Detailed Description

This is just a very thin wrapper around either a file descriptor or a SOCKET depending on platform, along with a couple of helper methods for explicitly converting to/from file descriptors, even on Windows.

Definition at line 30 of file NetworkSocket.h.

Member Typedef Documentation

Definition at line 35 of file NetworkSocket.h.

Constructor & Destructor Documentation

constexpr folly::NetworkSocket::NetworkSocket ( )
inline

Definition at line 41 of file NetworkSocket.h.

Referenced by fromFd().

static constexpr native_handle_type invalid_handle_value
Definition: NetworkSocket.h:36
native_handle_type data
Definition: NetworkSocket.h:39
constexpr folly::NetworkSocket::NetworkSocket ( native_handle_type  d)
inlineexplicit

Definition at line 42 of file NetworkSocket.h.

42 : data(d) {}
native_handle_type data
Definition: NetworkSocket.h:39

Member Function Documentation

Friends And Related Function Documentation

constexpr bool operator!= ( const NetworkSocket a,
const NetworkSocket b 
)
friend

Definition at line 59 of file NetworkSocket.h.

61  {
62  return !(a == b);
63  }
char b
char a
constexpr bool operator== ( const NetworkSocket a,
const NetworkSocket b 
)
friend

Definition at line 53 of file NetworkSocket.h.

55  {
56  return a.data == b.data;
57  }
char b
char a

Member Data Documentation

constexpr native_handle_type folly::NetworkSocket::invalid_handle_value = -1
static

Definition at line 36 of file NetworkSocket.h.


The documentation for this struct was generated from the following file: