ONPOSIX
2.0
|
Socket descriptor for connection-less communications. More...
#include <DgramSocketServerDescriptor.hpp>
Public Member Functions | |
DgramSocketServerDescriptor (const uint16_t port) | |
Constructor for UDP sockets. | |
DgramSocketServerDescriptor (const std::string &name) | |
Constructor for local connection-less sockets. | |
virtual | ~DgramSocketServerDescriptor () |
Destructor. | |
void | close () |
Close the descriptor. | |
Public Member Functions inherited from PosixDescriptor | |
virtual | ~PosixDescriptor () |
Destructor. | |
void | async_read (void(*handler)(Buffer *b, size_t size), Buffer *b, size_t size) |
Run asynchronous read operation. | |
void | async_read (void(*handler)(void *b, size_t size), void *b, size_t size) |
Run asynchronous read operation. | |
void | async_write (void(*handler)(Buffer *b, size_t size), Buffer *b, size_t size) |
Run asynchronous write operation. | |
void | async_write (void(*handler)(void *b, size_t size), void *b, size_t size) |
Run asynchronous write operation. | |
int | read (Buffer *b, size_t size) |
Method to read from the descriptor and fill a buffer. | |
int | read (void *p, size_t size) |
Method to read from the descriptor. | |
int | write (Buffer *b, size_t size) |
Method to write data in a buffer to the descriptor. | |
int | write (const void *p, size_t size) |
Method to write to the descriptor. | |
int | write (const std::string &s) |
Method to write a string to the descriptor. | |
int | getDescriptorNumber () const |
Method to get descriptor number. | |
PosixDescriptor (const PosixDescriptor &src) | |
Copy constructor. | |
PosixDescriptor & | operator= (const PosixDescriptor &src) |
Assignment operator. | |
bool | flush () |
Method to flush this specific descriptor. | |
int | ioctl (int request) |
Ioctl on the file descriptor. | |
int | ioctl (int request, void *argp) |
Ioctl on the file descriptor. |
Private Member Functions | |
DgramSocketServerDescriptor (const DgramSocketServerDescriptor &) | |
DgramSocketServerDescriptor & | operator= (const DgramSocketServerDescriptor &) |
Additional Inherited Members | |
Protected Member Functions inherited from PosixDescriptor | |
int | do_read (void *p, size_t size) |
Low-level read. | |
int | do_write (const void *p, size_t size) |
Low-level write. | |
PosixDescriptor () | |
Constructor. | |
Protected Attributes inherited from PosixDescriptor | |
int | fd_ |
Number of the file descriptor. |
Socket descriptor for connection-less communications.
This is a class to accept connection-less connections.
Example of usage:
Definition at line 52 of file DgramSocketServerDescriptor.hpp.
|
private |
DgramSocketServerDescriptor | ( | const uint16_t | port | ) |
Constructor for UDP sockets.
This constructor creates a connection-less AF_INET socket. It calls socket()+bind().
port | Port of the socket |
runtime_error | in case of error in socket(), bind() or listen() |
Definition at line 67 of file DgramSocketServerDescriptor.cpp.
DgramSocketServerDescriptor | ( | const std::string & | name | ) |
Constructor for local connection-less sockets.
This constructor creates a connection-less AF_UNIX socket. It calls socket()+bind().
name | Name of the local socket on the filesystem |
runtime_error | in case of error in socket(), bind() or listen() |
Definition at line 37 of file DgramSocketServerDescriptor.cpp.
|
inlinevirtual |
Destructor.
It just calls close() to close the descriptor.
Definition at line 66 of file DgramSocketServerDescriptor.hpp.
|
inlinevirtual |
Close the descriptor.
Reimplemented from PosixDescriptor.
Definition at line 73 of file DgramSocketServerDescriptor.hpp.
|
private |