22 DirectDClient::DirectDClient() {
25 DirectDClient::~DirectDClient() {
29 DirectDClient::cli_command(
const string& cmd) {
30 cerr<<
"command "<<cmd<<endl;
33 cerr<<
"Local command "<<std::flush;
40 cerr<<
"connect ("<<code<<
") to "<<host<<
" port "<<port<<endl;
44 if (cmd[0] ==
'q' && cmd.size()==1) {
52 DirectDClient::run_client(
const string& host,
int port) {
57 while (!cin.fail() && _connections.size()!=0) {
58 cout <<
"directd send: " << std::flush;
63 check_for_lost_connection();
64 check_for_datagrams();
70 main(
int argc,
char *argv[]) {
71 if (argc > 1 && strcmp(argv[1],
"--help")==0) {
72 cerr<<
"directd [[<host>] <port>]\n" 73 " host default localhost\n" 74 " port default 8001\n";
78 cerr<<
"directdClient "<<__DATE__<<
" "<<__TIME__<<endl;
79 string host=
"localhost";
85 port=(atoi(argv[argc-1]));
88 directd.run_client(host, port);
DirectDClient is a test app for DirectDServer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int connect_to(const std::string &server_host, int port)
Call connect_to from client for each server.
void send_command(const std::string &cmd)
Send the same command string to all current connections.