#include <iostream>
#include <ace/OS_main.h>
class a_main_t
:
{
public:
a_main_t(
:
base_type_t( env, notification_mbox )
{}
virtual ~a_main_t()
{}
virtual void
virtual void
virtual void
virtual void
virtual void
private:
};
void
a_main_t::so_handle_create_server_socket_result(
{
std::cout << "\na_main_t::so_handle_create_server_socket_result\n";
std::cout << "server socket successfuly created.";
else
{
std::cout << "server socket not created.";
so_environment().stop();
}
std::cout << std::endl;
}
void
a_main_t::so_handle_client_connected(
{
std::cout << "\na_main_t::so_handle_client_connected\n"
"local address: "
"remote address: "
}
void
a_main_t::so_handle_client_failed(
{
std::cout << "\na_main_t::so_handle_client_failed\n"
"reason: "<< msg.
m_reason << std::endl;
}
void
a_main_t::so_handle_client_disconnected(
{
std::cout << "\na_main_t::so_handle_client_disconnected\n"
}
void
a_main_t::so_handle_incoming_package(
{
const size_t stream_size = in_trx->stream_size();
if( stream_size > 0 )
{
std::cout << "\na_main_t::so_handle_incoming_package\n"
"available data size: " << stream_size << "\n"
"data:\n";
std::vector< char > data( stream_size );
in_trx->istream().read( &data[0], stream_size );
std::cout.write( &data[0], stream_size );
out_trx->ostream().write( &data[0], stream_size );
out_trx->commit();
std::cout << std::endl;
}
in_trx->commit();
}
void
{
"active_obj" ) );
acceptor_creator( env );
std::unique_ptr< a_server_transport_agent_t > ta(
new a_server_transport_agent_t(
env,
acceptor_creator.create( server_addr ) ) );
new a_main_t( env, ta->query_notificator_mbox() ) );
coop->add_agent( serv );
if( 0 != rc )
std::cerr << "reg coop ret_code = " << rc << "\n\n";
else
{
std::cout << "Type \"quit\" to quit." << std::endl;
std::string cmd;
do
{
std::cin >> cmd;
} while( cmd != "quit" );
}
}
int
main( int argc, char ** argv )
{
if( 2 == argc )
{
std::string server_addr( argv[ 1 ] );
&init,
server_addr,
.add_named_dispatcher(
.add_layer(
std::unique_ptr< so_5_transport::reactor_layer_t >(
}
else
std::cerr << "sample.so_5_transport.raw_channel.tcp_srv <port>" << std::endl;
return 0;
}