/******************************************************************* * sendclient.cpp * * * * Copyright (C) 2004, Inv3rsion, LLC, * * Goffstown, NH * * * * Author(s): Scott Coppen, Todd Furlong * *******************************************************************/ #include #include #include // Program Info: Example SinterPoint send client // Connects to a SinterPoint server and sends commands as they // are entered on the command line int main( int argc, char** argv ) { sinter::Sender sender; // Our SinterPoint sender class if(argc != 2) { std::cout << "Usage: ./sendclient servername" << std::endl; return ( 0 ); } // Declare program name & version info to server sender.SetType("DEMO"); // Session Name sender.SetVersion("1.0"); // version of this client // Configure server. This only takes effect if no other clients are // connected with a matching session name. If the server already has // another client connected, this client must obey the server configuration // set up by that earlier client. sender.SetMaxSend(1); // restrict server to only allow one send client if(!sender.Connect( argv[1] )) { std::cout << "Enter commands to send: (Control-C to break)" << std::endl; while( 1 ) // do until Ctrl-C { char buffer[80]; if( !fgets( buffer, 80, stdin ) ) // wait for user to enter command break; sender.Send( ( const char* )buffer ); // send command buffer to server } } return( 0 ); }