Open Lighting Architecture: ola::network::SocketCloser Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Public Member Functions | List of all members
ola::network::SocketCloser Class Reference
Network

## Detailed Description

Automatically close a socket when it goes out of scope.

This class is useful if you need to temporarily open a socket and want to make sure it's cleaned up. Think of it as an auto_ptr for file descriptors.

## Public Member Functions
| SocketCloser (int fd)
| Create a new SocketCloser.
| ~SocketCloser ()
| Destructor.
int | Release ()
| Release the file descriptor.

## Constructor & Destructor Documentation

## ◆ SocketCloser()

ola::network::SocketCloser::SocketCloser | ( | int | fd | ) |
| inlineexplicit

Create a new SocketCloser.

Parameters

  fd | the file descriptor to close.

## Member Function Documentation

## ◆ Release()

int ola::network::SocketCloser::Release | ( |  | ) |
| inline

Release the file descriptor.

Calling Release prevents the file descriptor from being closed when this object goes out of scope.

Returns
  the original file descriptor or -1 if the descriptor was already released.

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

- include/ola/network/SocketCloser.h
- common/network/SocketCloser.cpp