Results 1 to 4 of 4

Thread: Multi-client, multi-server configuration

  1. #1
    Cal30 is offline Registered User
    Name: Carlos Calatayud
    Organization: Universidad Castilla-La Mancha
    Project: Surveillance Communications
    Join Date
    Jul 2011
    Posts
    15

    Multi-client, multi-server configuration

    Hi,

    I've to create a system where a client must send data to his related server.
    Due to this, I'ill have many servers and clients.

    The system should be like attached image. diagram.png

    Server1 open a connection in port 10000, and Client1 sends and image in port 10000.

    Server2 open in port 20000 and Client2 sends in port 20000 ...

    Is there another way to implement this than creating threads for each connection? How?

    Thanks !

  2. #2
    Cal30 is offline Registered User
    Name: Carlos Calatayud
    Organization: Universidad Castilla-La Mancha
    Project: Surveillance Communications
    Join Date
    Jul 2011
    Posts
    15
    Hello?

    Up

  3. #3
    bernard's Avatar
    bernard is online now ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Carlos,

    Your question is not clear. Threads and connections are not tied with Ice: for example, a single thread in a client could open multiple connections (invoke on multiple servers), and multiple threads in a client can all share the same connection (invoke on objects in the same server / object adapter).

    Naturally, if you have 3 clients, and each of these clients is calling objects in 3 servers, Ice will open at least 3 * 3 = 9 connections.

    Cheers,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  4. #4
    Cal30 is offline Registered User
    Name: Carlos Calatayud
    Organization: Universidad Castilla-La Mancha
    Project: Surveillance Communications
    Join Date
    Jul 2011
    Posts
    15
    Ok, then I could have 3 clients calling the same function at the same server. But how can I do this sendind information in different ports?

    Example:
    1 server.
    3 clients. Client1, Client2, Client3. Each client sends grab pictures from a different directory and sends to the server.
    Client1 must send by port 10000, client2 by port 11000 and client3 by port 12000.

    How can i do this?

    my actual code is:

    Client code:
    Code:
    __declspec(dllexport) int run(){
    		Sleep(1000);
    		//std::string s(std::string(puerto) +":default -p "+std::string(puerto));
    		std::string s(std::string(puerto) +":default -p 10000");
    		Ice::CommunicatorPtr communicator; //Por ello tenemos que crear el Communicator
    		communicator = Ice::initialize();
    		Ice::ObjectPrx base = communicator->stringToProxy(s);
    		Proyecto::ImageProviderPrx imagenPrx = ImageProviderPrx::checkedCast(base);
    
    		if (strcmp(tipo,"JPG")==0){
    			coleccionImagenes(imagenPrx);
    		}
    		else if (strcmp(tipo, "AVI")==0){
    			archivoVideo(imagenPrx);
    		}
    
    		//communicator->waitForShutdown();
    		communicator->destroy();
    		/*if (communicator){
    			communicator->destroy();
    		}*/
    		return 0;
    	}
    Functions coleccionImagenes and archivoVideo calls sendImageData, which sends to server.
    run is executed in 3 threads, one per client(variable puerto changes in each call)

    Server code:
    Code:
    __declspec(dllexport) int run(){
    		Ice::CommunicatorPtr ic;
    		ic = Ice::initialize();
    		char* port=puerto;
    		//std::string s("default -p "+ std::string(port));
    		std::string s("default -p 10000");
    		Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints(port, s);
    		Ice::ObjectPtr object = new ImagenI(port);
    		cout << "Identidad adaptador ";
    		cout << adapter->getName().data() << endl;
    		adapter->add(object, ic->stringToIdentity("10000")); //si ponemos "Imagen" tenemos el mismo identificador para todos
    		adapter->add(object, ic->stringToIdentity("11000"));
    		adapter->activate();
    
    		ic->waitForShutdown();
    		ic->destroy();
    
    		if (ic) {
            try {
                ic->destroy();
            } catch (const Ice::Exception& e) {
                cerr << "cerrando";
    			}
    		}
        
    		return 0;
    	}

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Huge Virtual Memory Size in a multi-connections client
    By dscardaci in forum Help Center
    Replies: 4
    Last Post: 11-20-2008, 07:49 PM
  2. Multi IP address slow client connections.
    By Ian James in forum Help Center
    Replies: 1
    Last Post: 11-21-2007, 08:24 AM
  3. Replies: 3
    Last Post: 10-30-2007, 04:45 PM
  4. Replies: 4
    Last Post: 03-31-2004, 08:45 PM
  5. Replies: 3
    Last Post: 03-31-2004, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •