start_app() no longer kills prior app; added tell_server()
This commit is contained in:
parent
e51541e4ac
commit
9ea3af0608
|
|
@ -146,11 +146,18 @@ DirectD::~DirectD() {
|
|||
}
|
||||
|
||||
int
|
||||
DirectD::client_ready(const string& client_host, int port,
|
||||
DirectD::client_ready(const string& server_host, int port,
|
||||
const string& cmd) {
|
||||
stringstream ss;
|
||||
ss<<"!"<<cmd;
|
||||
send_one_message(client_host, port, ss.str());
|
||||
send_one_message(server_host, port, ss.str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
DirectD::tell_server(const string& server_host, int port,
|
||||
const string& cmd) {
|
||||
send_one_message(server_host, port, cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +211,6 @@ DirectD::server_ready(const string& client_host, int port) {
|
|||
void
|
||||
DirectD::start_app(const string& cmd) {
|
||||
nout<<"start_app(cmd="<<cmd<<")"<<endl;
|
||||
kill_app();
|
||||
_app_pid=StartApp(cmd);
|
||||
nout<<" _app_pid="<<_app_pid<<endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ typedef int intptr_t;
|
|||
// There are two API groups in this class, they are:
|
||||
//
|
||||
// listen_to()
|
||||
// client_ready()
|
||||
// client_ready() or tell_server()
|
||||
// wait_for_servers()
|
||||
// server_ready()
|
||||
//
|
||||
|
|
@ -82,7 +82,19 @@ PUBLISHED:
|
|||
// A new connection will be created and closed. If you
|
||||
// want to send more than one command, you should use
|
||||
// connect_to(), send_command(), and disconnect_from().
|
||||
int client_ready(const string& client_host, int port, const string& cmd);
|
||||
int client_ready(const string& server_host, int port, const string& cmd);
|
||||
|
||||
// Description: Tell the server to do the command cmd.
|
||||
// cmd is one of the following:
|
||||
// "k" Kill the most recent application started with
|
||||
// client_ready() or "!".
|
||||
// "q" Tell the server to quit.
|
||||
// "!cmd" Exectue the cmd on the server (this is a dos shell
|
||||
// command; if you want a bash command, include bash
|
||||
// in the command e.g. "!bash pwd"). When you call
|
||||
// client_ready(), it prefixes "!" for you.
|
||||
// A new connection will be created and closed.
|
||||
int tell_server(const string& server_host, int port, const string& cmd);
|
||||
|
||||
// Description: Call this function from the client after
|
||||
// calling <count> client_ready() calls.
|
||||
|
|
|
|||
Loading…
Reference in New Issue