@@ -204,13 +215,11 @@ int main(int argc, const char* argv[])
puts("type "QUIT_COMMAND" to end.");
service_pumpsp;
//only need a simple server? you can directly use server or tcp::server_base, because of normal_socket,
//this server cannot support fixed_length_packer/fixed_length_unpacker and prefix_suffix_packer/prefix_suffix_unpacker,
//the reason is these packer and unpacker need additional initializations that normal_socket not implemented,
//see echo_socket's constructor for more details.
server_base<normal_socket>normal_server(sp);
server_base<short_connection>short_server(sp);
//because of normal_socket, this server cannot support fixed_length_packer/fixed_length_unpacker and prefix_suffix_packer/prefix_suffix_unpacker,
//the reason is these packer and unpacker need additional initializations that normal_socket not implemented, see echo_socket's constructor for more details.
normal_servernormal_server_(sp);
echo_serverecho_server_(sp);//echo server
server_base<short_connection>short_server(sp);
unsignedshortport=ASCS_SERVER_PORT;
std::stringip;
...
...
@@ -219,7 +228,7 @@ int main(int argc, const char* argv[])
if(argc>3)
ip=argv[3];
normal_server.set_server_addr(port+100,ip);
normal_server_.set_server_addr(port+100,ip);
short_server.set_server_addr(port+200,ip);
echo_server_.set_server_addr(port,ip);
...
...
@@ -247,19 +256,19 @@ int main(int argc, const char* argv[])
}
elseif(STATISTIC==str)
{
printf("normal server, link #: "ASCS_SF", invalid links: "ASCS_SF"\n",normal_server.size(),normal_server.invalid_object_size());
printf("normal server, link #: "ASCS_SF", invalid links: "ASCS_SF"\n",normal_server_.size(),normal_server_.invalid_object_size());
printf("echo server, link #: "ASCS_SF", invalid links: "ASCS_SF"\n\n",echo_server_.size(),echo_server_.invalid_object_size());
@@ -271,7 +280,7 @@ int main(int argc, const char* argv[])
{
// /*
//broadcast series functions call pack_msg for each client respectively, because clients may used different protocols(so different type of packers, of course)