Qpid Proton C++  0.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | List of all members
socket_engine Class Reference

A connection_engine for socket-based IO. More...

#include <io.hpp>

Inheritance diagram for socket_engine:
connection_engine

Public Types

enum  io_flag { READ, WRITE }
 Combine these flags with | to indicate read, write, both or neither.
 

Public Member Functions

 socket_engine (descriptor socket_, handler &, const connection_options &=no_opts)
 Wrap an open socket. Sets non-blocking mode.
 
 socket_engine (const url &, handler &, const connection_options &=no_opts)
 Create socket engine connected to url.
 
descriptor socket () const
 Get the socket descriptor.
 
void run ()
 Start the engine.
 
size_t can_read () const
 Return the number of bytes that the engine is currently ready to read.
 
size_t can_write () const
 Return the number of bytes that the engine is currently ready to write.
 
bool process (int io_flags=READ|WRITE)
 Read, write and dispatch events. More...
 
bool process_nothrow (int io_flags=READ|WRITE)
 Non-throwing version of process. More...
 
bool closed () const
 True if the engine is closed, meaning there are no further events to process and close_io has been called. More...
 
std::string error_str () const
 If the engine was closed by an error, return a pointer.
 
class connection connection () const
 Get the AMQP connection associated with this connection_engine.
 
class transport transport () const
 Get the transport associated with this connection_engine.
 
void disconnect ()
 Disconnect the engine.
 

Detailed Description

A connection_engine for socket-based IO.

Examples:
engine/broker.cpp, engine/client.cpp, engine/direct_recv.cpp, engine/direct_send.cpp, engine/helloworld.cpp, engine/server.cpp, engine/simple_recv.cpp, and engine/simple_send.cpp.

Member Function Documentation

bool closed ( ) const
inherited

True if the engine is closed, meaning there are no further events to process and close_io has been called.

Call error_str() to get an error description.

Examples:
engine/broker.cpp.
bool process ( int  io_flags = READ|WRITE)
inherited

Read, write and dispatch events.

io_flags indicates whether to read, write, both or neither. dispatches all events generated by reading or writing.

Exceptions
proton::closed_errorif closed() is true before calling process()
proton::io_errorif the engine is closed by an error.
Returns
true if process should be called again, i.e. !closed()
bool process_nothrow ( int  io_flags = READ|WRITE)
inherited

Non-throwing version of process.

Use closed() and error_str() to check the status of the engine.

Examples:
engine/broker.cpp.

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