Socket server stream. More...
Public Member Functions | |
virtual void | flush () |
Flushes stream. | |
virtual void | flush () |
Flushes stream. | |
virtual bool | isDataInRecvBuffer () const |
Return true while there is some unread data in the reception buffer. | |
virtual void | notifyEvent (Hub *srv, EvType &t) |
Callback when an event is notified, allowing the stream to rearm it. | |
virtual void | read (void *data, size_t size) |
Reads data from the stream. | |
virtual void | read (void *data, size_t size) |
Reads data from the stream. | |
virtual bool | receiveDataAndCheckDisconnection () |
If necessary, read a byte and check for disconnection; return true on disconnection, fales otherwise. | |
SocketServerStream (const std::string ¶ms, const bool resolveIncomingNames) | |
Create the stream and associates a file descriptor. | |
SocketServerStream (const std::string &targetName) | |
Create the stream and associates a file descriptor. | |
virtual void | write (const void *data, const size_t size) |
Write data to the stream. | |
virtual void | write (const void *data, const size_t size) |
Write data to the stream. | |
~SocketServerStream () | |
Destructor. | |
Protected Attributes | |
HANDLE | hev |
The real data event handle. | |
const bool | resolveIncomingNames |
SOCKET | sock |
The socket. |
Socket server stream.
This stream is used for listening for incoming connections. It cannot be used for transfering data.
Definition at line 490 of file dashel-posix.cpp.
Dashel::SocketServerStream::SocketServerStream | ( | const std::string & | targetName | ) | [inline] |
Create the stream and associates a file descriptor.
Definition at line 494 of file dashel-posix.cpp.
Dashel::SocketServerStream::SocketServerStream | ( | const std::string & | params, | |
const bool | resolveIncomingNames | |||
) | [inline] |
Create the stream and associates a file descriptor.
Definition at line 331 of file dashel-win32.cpp.
Dashel::SocketServerStream::~SocketServerStream | ( | ) | [inline] |
Destructor.
Definition at line 369 of file dashel-win32.cpp.
virtual void Dashel::SocketServerStream::flush | ( | ) | [inline, virtual] |
Flushes stream.
Calling this function requests the stream to be flushed, this may ensure that data is written to physical media or actually sent over a wire. The exact performed function depends on the stream type and operating system.
Implements Dashel::Stream.
Definition at line 406 of file dashel-win32.cpp.
virtual void Dashel::SocketServerStream::flush | ( | ) | [inline, virtual] |
Flushes stream.
Calling this function requests the stream to be flushed, this may ensure that data is written to physical media or actually sent over a wire. The exact performed function depends on the stream type and operating system.
Implements Dashel::Stream.
Definition at line 527 of file dashel-posix.cpp.
virtual bool Dashel::SocketServerStream::isDataInRecvBuffer | ( | ) | const [inline, virtual] |
Return true while there is some unread data in the reception buffer.
Implements Dashel::SelectableStream.
Definition at line 530 of file dashel-posix.cpp.
Callback when an event is notified, allowing the stream to rearm it.
srv | Hub instance. | |
t | Type of event. |
Reimplemented from Dashel::WaitableStream.
Definition at line 379 of file dashel-win32.cpp.
virtual void Dashel::SocketServerStream::read | ( | void * | data, | |
size_t | size | |||
) | [inline, virtual] |
Reads data from the stream.
Reads all requested data from the stream, blocking until all the data has been read, or some error occurs. Errors are signaled by throwing a DashelException exception, which may be caused either by device errors or reaching the end of file.
data | Pointer to the memory where the read data should be stored. | |
size | Amount of data to read in bytes. |
Implements Dashel::Stream.
Definition at line 407 of file dashel-win32.cpp.
virtual void Dashel::SocketServerStream::read | ( | void * | data, | |
size_t | size | |||
) | [inline, virtual] |
Reads data from the stream.
Reads all requested data from the stream, blocking until all the data has been read, or some error occurs. Errors are signaled by throwing a DashelException exception, which may be caused either by device errors or reaching the end of file.
data | Pointer to the memory where the read data should be stored. | |
size | Amount of data to read in bytes. |
Implements Dashel::Stream.
Definition at line 528 of file dashel-posix.cpp.
virtual bool Dashel::SocketServerStream::receiveDataAndCheckDisconnection | ( | ) | [inline, virtual] |
If necessary, read a byte and check for disconnection; return true on disconnection, fales otherwise.
Implements Dashel::SelectableStream.
Definition at line 529 of file dashel-posix.cpp.
virtual void Dashel::SocketServerStream::write | ( | const void * | data, | |
const size_t | size | |||
) | [inline, virtual] |
Write data to the stream.
Writes all requested data to the stream, blocking until all the data has been written, or some error occurs. Errors are signaled by throwing a DashelException exception. This function does not flush devices, therefore the data may not really have been written on return, but only been buffered. In order to flush the stream, call flush().
data | Pointer to the data to write. | |
size | Amount of data to write in bytes. |
Implements Dashel::Stream.
Definition at line 405 of file dashel-win32.cpp.
virtual void Dashel::SocketServerStream::write | ( | const void * | data, | |
const size_t | size | |||
) | [inline, virtual] |
Write data to the stream.
Writes all requested data to the stream, blocking until all the data has been written, or some error occurs. Errors are signaled by throwing a DashelException exception. This function does not flush devices, therefore the data may not really have been written on return, but only been buffered. In order to flush the stream, call flush().
data | Pointer to the data to write. | |
size | Amount of data to write in bytes. |
Implements Dashel::Stream.
Definition at line 526 of file dashel-posix.cpp.
HANDLE Dashel::SocketServerStream::hev [protected] |
The real data event handle.
Whether Dashel should try to resolve the peer's hostname of incoming TCP connections
Definition at line 325 of file dashel-win32.cpp.
const bool Dashel::SocketServerStream::resolveIncomingNames [protected] |
Definition at line 326 of file dashel-win32.cpp.
SOCKET Dashel::SocketServerStream::sock [protected] |
The socket.
Definition at line 320 of file dashel-win32.cpp.