15 #include "directdServer.h"
17 DirectDServer::DirectDServer() {
20 DirectDServer::~DirectDServer() {
24 DirectDServer::handle_command(
const string& cmd) {
25 nout<<
"DirectDServer::handle_command: "<<cmd<<
", size="<<cmd.size()<<endl;
35 cerr<<
"unknown command: "<<cmd<<endl;
44 int index = atoi(cmd.substr(1, string::npos).c_str());
49 string c=cmd.substr(1, string::npos);
62 DirectDServer::read_command(
string& cmd) {
65 f.open(
"directdCommand", ios::in | ios::binary);
67 const int buf_size=512;
69 f.getline(buf, buf_size);
72 cerr<<
"read_command "<<cmd<<endl;
78 cerr<<
"DirectD::read_command() exception."<<endl;
83 DirectDServer::run_server(
int port) {
89 check_for_new_clients();
90 check_for_lost_connection();
91 check_for_datagrams();
100 main(
int argc,
char *argv[]) {
101 if (argc > 1 && strcmp(argv[1],
"--help")==0) {
102 cerr<<
"directd [<port>]\n"
103 " port default 8001\n";
107 cerr<<
"directdServer "<<__DATE__<<
" "<<__TIME__<<endl;
110 port=(atoi(argv[argc-1]));
113 directd.run_server(port);
Start a directdServer on each of the machines you which to start panda on.