Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

address.cpp

00001 /*
00002    CABAL Protocol
00003    Test for address structure (and names lookup)
00004 
00005    $Id: address.cpp,v 1.2 2004/03/15 04:22:35 jonnymind Exp $
00006 ---------------------------------------------
00007    Begin      :
00008    Author     : Giancarlo Niccolai
00009 
00010    Last modified because:
00011 
00012 */
00013 
00014 #include <cabal_address.h>
00015 
00016 int main ( int argc, char *argv[] )
00017 {
00018    Cabal::Net::init();
00019 
00020    char *c_addr;
00021    if ( argc > 1 ) {
00022       c_addr = argv[1];
00023    }
00024    else {
00025       c_addr = "google.com";
00026    }
00027 
00028    Cabal::Address addr( c_addr );
00029    if ( addr.scan() ) {
00030       std::cout << "Success:\n"<<
00031          "Host: " << addr.host() << "\n" <<
00032          "IP: " << addr.ip() << "\n" <<
00033          "Other ips:\n";
00034 
00035       Cabal::StringList *lst = addr.listOfIps();
00036       Cabal::StringListIter iter = lst->begin();
00037       while( iter != lst->end() )
00038       {
00039          std::cout << *iter << "\n";
00040          iter++;
00041       }
00042    }
00043    else
00044       std::cout << "FAILURE\n";
00045       
00046    Cabal::Net::exit();
00047 }

Generated on Sat Apr 10 17:41:48 2004 for Cabal by doxygen 1.3.5