/** * Constructors */ UnixRemoteClientConnection::UnixRemoteClientConnection (int clientSocket) throw(IOException, bad_exception) : RemoteClientConnection(), _inStream(clientSocket), _outStream(clientSocket) { _clientSocket = clientSocket; //send robotname to master-server MasterResourceControl* mrc = MasterResourceControl::Instance(); string robotName; try { robotName = mrc->getRuntimeProperty("Main","ActualName"); } catch(KeyNotFoundException& e) { throw IOException("Could not get ActualName from section Main. KeyNotFoundException occured: " + e.getMessage()); } //append pid to robotname ostringstream int2string; int2string << getpid(); robotName += " (pid: "; robotName += int2string.str(); robotName += ")"; //send name to remoteclient sendLine(robotName); //get name from remoteclient _targetName = getLine(); }
/** * @return name of the associated target */ string UnixRTBConnection::getTargetName () throw(IOException, bad_exception) { //get ActualName MasterResourceControl* mrc = MasterResourceControl::Instance(); string robotName; try { robotName = mrc->getRuntimeProperty("Main","ActualName"); } catch(KeyNotFoundException& e) { throw IOException("Could not get ActualName from section Main. KeyNotFoundException occured: " + e.getMessage()); } //append pid to robotname ostringstream int2string; int2string << getpid(); robotName += " (pid: "; robotName += int2string.str(); robotName += ")"; return robotName; }