C++ World

C++ Resources, Tips,
Documentation, Examples,
HOWTO's, FAQ's, Tools
Libraries, Frameworks, IDE's

 
© 2005,2009 C++ World - All rights reserved - webdesign.arttina
C++, Sockets, SysProg, Libraries, Examples, Tools, Compilers, IDE, STL, XML
Google
FAQ Sockets Socket Library Software Engineering Sysprog Examples Books
 
Home
C++
The C Language
STL
BOOST
GNU
GNU C Compiler
GNU Debugger
GNU Profiler
HP C++ Compiler
DDD
Eclipse
Curses
XML
X11
KDevelop
MS Visual Studio
Tutorials
// **************************************************************
// Com ++ Framework by the C++ World
// Please report defects: mailto:compp@cplusplusworld.com
// Please visit: http://www.cplusplusworld.com/socketlibrary.html
// **************************************************************

#include <iostream>
#include <string>
#include <cstdlib>
#include "ComPlusPlus/ComPlusPlus"
 
int main (int argc, char *argv [] ) {

  int port;
  std::string host = "127.0.0.1";

  if ( argc >= 2 )
	port = atoi ( argv [ 1 ] );
  else
	port = 5678 ;

  if ( argc >= 3 )
	host = argv [2 ];

  int tries =1;

  if ( argc == 4 )
	tries = atoi( argv [3 ]);

try {
  compp::SClnt C( host, port) ;

 std::string ret ="";
  for ( int i=0; i < tries ; ++ i ) {
    ret = C.requestTransaction ( "Heya", true);
  }
  std::cout << "Received (cypered) " << ret << "\n";

  for ( int i=0; i < tries ; ++ i ) {
    ret = C.requestTransaction ( "Heya", false );
  }
  std::cout << "Received (plain) " << ret << "\n";


} catch (  syspp::ComException  &e) {
   std::cout << "Exception " << e.what() << "\n";
}
	  

  return 0;	
}


syntax highlighted by Code2HTML, v. 0.9.1


Franz Brandel Contact Legal Statement Sitemap C++ World