Exemplo n.º 1
0
/**************************************
* RequestHandler
*	Callback
**************************************/
void XmlRpcServer::RequestHandler(void *par,TSession *ses, abyss_bool *ret)
{
	//Obtenemos el servidor
	XmlRpcServer *serv = (XmlRpcServer *)par;

	//Procesamos la llamada
	*ret = serv->DispatchRequest(ses);
}
Exemplo n.º 2
0
void runServer()
{
	int port = 7776;
	XmlRpc::setVerbosity(5);
	s.bindAndListen(port);
	s.enableIntrospection(true);
	s.work(-1.0);
}
Exemplo n.º 3
0
Server::Server( const QString &address, quint16 port, QObject *parent )
      : QObject( parent )
{
      XmlRpcServer *srv = new XmlRpcServer;
      if ( srv->listen( QHostAddress( address ), port ) ) {
            srv->registerSlot( this, SLOT( testFunc(QVariant) ) );
      }
}
Exemplo n.º 4
0
int _tmain(int argc, _TCHAR* argv[])
{
	DWORD dwXmlRpcThreadID;
	PROCESS_INFORMATION pi;
	HANDLE hXMLRpcClientThread;
	bool ThreadCreated=false;

	LogLevel=1;
	Log(1,L"ITEScreenWatch V 0.1");

	MyGetIpAdress();	// read IP into g_pLocalIP

	InitScreenContent();

	CreateProcess(L"\\Program Files\\Intermec\\ITE\\intermte.exe", L"", NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi); 
	Sleep(10000);
	hWndITEWindow = FindWindow(_T("IntermTE"), _T("ITE"));
	if (hWndITEWindow==NULL)
	{
		Log(1,L"FindWindows ITE failes");
	}
	else
	{
		hXMLRpcClientThread=CreateThread(NULL, 0, XMLRpcClientThread, (VOID *)0, 0,&dwXmlRpcThreadID);
		if (hXMLRpcClientThread == NULL)
		{
			Log(1,L"CreateThread failed");
		}
		else
		{
			Log(1,L"CreateThread OK");
			ThreadCreated=true;
		}
	}
	
	Log(1,L"Waiting for TE exit");
	do{
		WaitForSingleObject(pi.hProcess,INFINITE);
	}while((FindWindow(_T("IntermTE"), _T("ITE")))!=NULL);

	Log(1,L"ITE Exit");

	if (ThreadCreated)
	{
		s.exit();
		s.shutdown();
	}
	//Sleep(2000);
	TerminateThread(hXMLRpcClientThread,1);
	//Log(L"Wait Thread end");
	//WaitForSingleObject(hXMLRpcClientThread,INFINITE);
	Sleep(1000);
	
	closeMsgQueue(g_hMsgQueue);

	Log(1,L"Program Exit");
	return 0;
}
Exemplo n.º 5
0
int main(int argc, char* argv[])
{
  XmlRpc::setVerbosity(5);

  // Create the server socket on the specified port
  s.bindAndListen(0);

  // Enable introspection
  s.enableIntrospection(true);

  // Wait for requests indefinitely
  s.work(-1.0);

  return 0;
}
Exemplo n.º 6
0
int main(int argc, char* argv[]) 
{
    cout << "=========================================================" << endl;
    cout << "===               CHAT SERVER XMLRPC                  ===" << endl;
    cout << "===          Prof. Me. Petrônio Cândido               ===" << endl;
    cout << "===      Sistemas Distribuídos, FACIT 2012            ===" << endl;
    cout << "=========================================================" << endl;
 
  
    int port = 8000; 

    //XmlRpc::setVerbosity(5); 

    s.bindAndListen(port); 

    s.enableIntrospection(true); 

    s.work(-1.0); 
 
    /*
    
    ChatServer server;
    
    char *usr1 = "teste1";
    char *usr2 = "teste2";
    
    server.Registrar(usr1);
    
    server.Registrar(usr2);
   
    server.Enviar(usr2, usr1, "Teste1");
    server.Enviar(usr2, usr1, "Teste2");
    server.Enviar(usr2, usr1, "Teste3");
    
    mensagem m1 = server.Receber(usr1);    
    
    cout << m1.corpo << endl;
    
    string s;

    cin >> s;
    */

    //return 0; 



} 
Exemplo n.º 7
0
int main(int argc, char* argv[])
{
	std::vector<std::string> lst;

	ImageSearchServer imageSearch(&s);

	//std::string datasetPath = "/Users/jquequezana/workspace/files/flickr";
	//std::string dataExtension  = ".rgb";

	std::string datasetPath = "/Users/jquequezana/workspace/files/facedb2";
	std::string dataExtension  = ".sfi.pca";
	
    imageSearch.setConfiguration(datasetPath, dataExtension);
	//imageSearch.getRandomSet(datasetPath);
	imageSearch.query("01.jpg", 20 );
/*
	datasetPath = "C:/xampp/htdocs/cbir/Caltech-256";
	dataExtension  =   ".jpg.oRGBHistograms";

	imageSearch.setConfiguration(datasetPath, dataExtension);
	//imageSearch.getRandomSet(datasetPath);
	imageSearch.query("024_0056.jpg", 10 );*/



/*	datasetPath = "C:/xampp/htdocs/cbir/PIBAP";
	dataExtension  =   ".jpg.eGeometricFeatures2";

	imageSearch.setConfiguration(datasetPath, dataExtension);
	imageSearch.getRandomSet(datasetPath);
	imageSearch.query("1_2_1.jpg", 10 );*/

	int port = 9090;

	XmlRpc::setVerbosity(5);

	// Create the server socket on the specified port
	s.bindAndListen(port);

	// Enable introspection
	s.enableIntrospection(true);

	// Wait for requests indefinitely
	s.work(-1.0);

	return 0;
}
Exemplo n.º 8
0
int main(int argc, char* argv[])
{
  if (argc != 2) {
    std::cerr << "Usage: Validator port\n";
    return -1;
  }
  int port = atoi(argv[1]);

  XmlRpc::setVerbosity(5);

  // Create the server socket on the specified port
  s.bindAndListen(port);

  // Wait for requests indefinitely
  s.work(-1.0);

  return 0;
}
Exemplo n.º 9
0
static DWORD RPCListener(LPVOID lpData) 
{
	int port=12345;

	//  XmlRpc::setVerbosity(5);

	// Create the server socket on the specified port
	s.bindAndListen(port);

	// Enable introspection
	s.enableIntrospection(true);

	// Wait for requests indefinitely
	s.work(-1.0);
	Log(1,L"XMLRPC Server exit");
	return 1;

}
Exemplo n.º 10
0
int main(int argc, char* argv[])
{
    if (argc != 2) {
        std::cerr << "Usage: HelloServer serverPort\n";
        return -1;
    }
    int port = atoi(argv[1]);

    XmlRpc::setVerbosity(5);

    // Create the server socket on the specified port
    s.bindAndListen(port, "");

    // Enable introspection
    s.enableIntrospection(true);

    // Wait for requests indefinitely
    s.work(-1.0);

    return 0;
}
Exemplo n.º 11
0
  void execute(XmlRpcValue& params, XmlRpcValue& result)
  {
    std::ifstream infile("pngnow.png", std::ios::binary);
    if (infile.fail())
      infile.open("../pngnow.png", std::ios::binary);
    if (infile.fail())
      result = "Could not open file pngnow.png";
    else {

      XmlRpcValue::BinaryData& data = result;
      int n = 0;
      for (;; ++n) {
        char c = infile.get();
        if (infile.eof()) break;
        data.push_back(c);
      }
      s.exit();
      std::cerr << "Read " << n << " bytes from pngnow.png\n";
    }
  }
Exemplo n.º 12
0
void xml_rpc_server_listen(void)
{
  s.bindAndListen(mmaster.port());
  s.work(-1.0);
}
Exemplo n.º 13
0
int main(int argc, char **argv)
{

  ros::init(argc, argv, "mmaster", ros::init_options::AnonymousName);

  if (!mmaster.readAddressMaster())
  {
	cout << "There is no ROS_MASTER environment variable. Exiting ..." << endl;
	exit(1);
  }

  mmaster.getIPAddress();
  
  srand(time(NULL));
  mmaster.setPort((rand() % 64512) + 1024);    // choose a random a port between 1024 and 65536																																									// ports below 1024 requires root privileges and
			// max port number is 65536
 
//  XmlRpc::setVerbosity(3);

  thread_exit = false;
  
  boost::thread xml_rpc_server_thread(xml_rpc_server_listen);
 
  // Set false on first call to test later if I choose a port not used
  mmaster.alreadyAddMyAddress(false);
  boost::thread update_mmaster_addresses_thread(update_mmaster_addresses);

  #ifdef DEBUG
  cout << "main: Vou entrar no laço de leitura do teclado" << endl;
  #endif

  string keyboard_input;
  
  while(true)
    {
    cin >> keyboard_input;
    if (keyboard_input == "exit")
      {
		  cout << "main: Finishing this master" << endl; 
		  break;
      }
    if (keyboard_input == "print")
      {
         mmaster.printServerInfo();
      }
    }

  thread_exit = true;

  // Shutdown XML RPC Server
  s.shutdown();

  ros::NodeHandle node_handle;
  string mmaster_addresses;

  ROS_INFO("Consulting param /mmaster_addresses");

  // Get updated list from parameter server
  node_handle.getParam("/mmaster_addresses", mmaster_addresses);

  // TODO
  // send a notification to others masters to notify that i am leaving

  mmaster_addresses = mmaster.removeMyAddress(mmaster_addresses);

  if (mmaster_addresses != "")
    {
    // Remove my address from parameter server
    node_handle.setParam("/mmaster_addresses", mmaster_addresses);
    }
  else
    // I am the last server, remove the param
    node_handle.deleteParam("/mmaster_addresses");

  return 0;
}