20 DirectDServer::DirectDServer() {
23 DirectDServer::~DirectDServer() {
27 DirectDServer::handle_command(
const string& cmd) {
28 nout<<
"DirectDServer::handle_command: "<<cmd<<
", size="<<cmd.size()<<endl;
38 cerr<<
"unknown command: "<<cmd<<endl;
47 int index = atoi(cmd.substr(1, string::npos).c_str());
52 string c=cmd.substr(1, string::npos);
65 DirectDServer::read_command(
string& cmd) {
68 f.open(
"directdCommand", std::ios::in | std::ios::binary);
70 const int buf_size=512;
72 f.getline(buf, buf_size);
75 cerr<<
"read_command "<<cmd<<endl;
81 cerr<<
"DirectD::read_command() exception."<<endl;
86 DirectDServer::run_server(
int port) {
92 check_for_new_clients();
93 check_for_lost_connection();
94 check_for_datagrams();
103 main(
int argc,
char *argv[]) {
104 if (argc > 1 && strcmp(argv[1],
"--help")==0) {
105 cerr<<
"directd [<port>]\n" 106 " port default 8001\n";
110 cerr<<
"directdServer "<<__DATE__<<
" "<<__TIME__<<endl;
113 port=(atoi(argv[argc-1]));
116 directd.run_server(port);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void listen_to(int port, int backlog=8)
Call listen_to in the server.
Start a directdServer on each of the machines you which to start panda on.