15 #include "directdClient.h" 17 DirectDClient::DirectDClient() {
20 DirectDClient::~DirectDClient() {
24 DirectDClient::cli_command(
const string& cmd) {
25 cerr<<
"command "<<cmd<<endl;
28 cerr<<
"Local command "<<flush;
35 cerr<<
"connect ("<<code<<
") to "<<host<<
" port "<<port<<endl;
36 connect_to(host, port);
39 if (cmd[0] ==
'q' && cmd.size()==1) {
47 DirectDClient::run_client(
const string& host,
int port) {
50 connect_to(host, port);
52 while (!cin.fail() && _connections.size()!=0) {
53 cout <<
"directd send: " << flush;
58 check_for_lost_connection();
59 check_for_datagrams();
65 main(
int argc,
char *argv[]) {
66 if (argc > 1 && strcmp(argv[1],
"--help")==0) {
67 cerr<<
"directd [[<host>] <port>]\n" 68 " host default localhost\n" 69 " port default 8001\n";
73 cerr<<
"directdClient "<<__DATE__<<
" "<<__TIME__<<endl;
74 string host=
"localhost";
80 port=(atoi(argv[argc-1]));
83 directd.run_client(host, port);
DirectDClient is a test app for DriectDServer.