Archived

This forum has been archived. Please start a new discussion on GitHub.

get client's IP using glacier2router

hi ,

how Ice server can get the ICE client's IP if i use glacier2router?

Andrew

Comments

  • marc
    marc Florida
    You would have to send it as part of a request. There is no way to find out the IP address implicitly. In general, I would be careful with any design that relies on having to know the client's IP address other than for debug purposes. What do you need it for?
  • because i want send the client ip to another client , i want to use the server like a ip triangolator .

    i obtain the ip of client call the current.con->toString() from a callback, have another idea?
  • marc
    marc Florida
    What does the other client do with the IP address? If you want the two clients to communicate with each other directly, then the usual way to do this is to send a proxy from one client to the other over the server. The proxy embeds the IP address and any additional information that is required to reach the client.
  • i have patch the source code of Glacier2 :

    in SessionRouterI.cpp:
    function : virtual void createSession()
    I add that:
     		string str(_current.con->toString());
    		string key("remote address = ");
    		size_t start(str.rfind(key));
    	
    		if(start != string::npos)
    		{
    			str = str.substr(start + key.length());
    			str = str.substr(0, str.find_first_of(":")) ;
    		}
    		else
    			str = "";
    
    		map<string, string> contextMap;
    		contextMap["remote"]=str;
    
            _sessionRouter->_sessionManager->create_async(new CreateCB(this), _user, _control, contextMap );//_current.ctx);