ONPOSIX  2.0
Public Member Functions | List of all members
StreamSocketServerDescriptor Class Reference

Socket descriptor for connection-oriented communications. More...

#include <StreamSocketServerDescriptor.hpp>

Inheritance diagram for StreamSocketServerDescriptor:
Inheritance graph

Public Member Functions

  Constructor to accept() connections on a socket.
- 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.
virtual void  close ()
  Method to close the descriptor.
int  getDescriptorNumber () const
  Method to get descriptor number.
  Copy constructor.
  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.

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.
  Constructor.
- Protected Attributes inherited from PosixDescriptor
int  fd_
  Number of the file descriptor.

Detailed Description

Socket descriptor for connection-oriented communications.

This is a class to accept connection-oriented connections. This descriptor corresponds to a socket created with accept() over a StreamSocketServer.

Example of usage:

StreamSocketServer serv ("/tmp/mysocket");
Buffer b (10);
des.read(b, b.getSize());

Definition at line 44 of file StreamSocketServerDescriptor.hpp.

Constructor & Destructor Documentation

explicit

Constructor to accept() connections on a socket.

This constructor calls accept().

Parameters
socket StreamSocketServer on which a new connection must be accepted.
Exceptions
runtime_error in case of error in accept()

Definition at line 33 of file StreamSocketServerDescriptor.cpp.

{
fd_ = accept(socket.getDescriptorNumber(), NULL, 0);
if (fd_ < 0) {
ERROR("accept()");
throw std::runtime_error("Accept error");
}
}

Here is the call graph for this function:


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

AltStyle によって変換されたページ (->オリジナル) /