ClientMain::ClientMain ( string  newRemoteAddress,
string  newRemotePort,
string  newPollingPeriod,
string  newNetworkTimeout 
) throw (const char *)

Definition at line 24 of file ClientMain.cpp.

00025 :working(false), serviceNeeded(false), allowRequestService(true), pMainNetInterface(0), pCallbackNetInterface(0), pServiceOffer(0) {
00026         remoteAddress = newRemoteAddress;
00027         remotePort = atoi(newRemotePort.c_str());
00028         if (remotePort <= 0) {
00029                 throw "Invalid port number specified. Canceling...";
00030         }
00031         pollingPeriod = atoi(newPollingPeriod.c_str());
00032         if (pollingPeriod <= 0) {
00033                 throw "Invalid polling period specified. Canceling...";
00034         }
00035         pollingPeriod = pollingPeriod;  // sleep() takes seconds as argument
00036         networkTimeout = atoi(newNetworkTimeout.c_str());
00037         if (networkTimeout <= 0) {
00038                 throw "Invalid network timeout specified. Canceling...";
00039         }
00040         networkTimeout = networkTimeout*1000;  // the net interface takes millis for timeout
00041         try {
00042                 pMainNetInterface = new NetInterface(remoteAddress.c_str(),remotePort);
00043                 pCallbackNetInterface = new NetInterface(remoteAddress.c_str(),remotePort+1);
00044         }
00045         catch ( NetInterfaceException& e ) {
00046                 e.print();
00047                 throw "Failed setting up the socket. Canceling...";
00048         }
00049         if ( pthread_mutex_init(&criticalSection,0) ) {
00050                 throw "Failed to initialize the mutex that assures our threads to be synchroneous...";
00051         }
00052 }


Generated on Wed Jun 25 14:47:08 2008 for keyvil by  doxygen 1.5.1