int SimulatedClient::queryConnectServer(int queryMethod){ if(queryMethod == Markov){ double expectedQoS = _controller->predictQoS(_currentClientPosition, connectedServer()); _predictQoS.push_back(expectedQoS); _nextConnectedServerName = _controller->checkOptimalConnectedServer(_currentClientPosition, connectedServer()); }else if(queryMethod == Load){ _nextConnectedServerName = _controller->checkLowestLoadServer(_myAddr); }else if(queryMethod == NeverMigrate){ _nextConnectedServerName = _controller->checkNerverMigrateServer(connectedServer()); //_nextConnectedServerName = connectedServer(); }else if(queryMethod == Nearest){ _nextConnectedServerName = _controller->checkNearestServer(_currentClientPosition); //_nextConnectedServerName = _currentClientPosition / 5; } return _nextConnectedServerName; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowClass) { ui->setupUi(this); socket = new JagunKET(this); connected = false; connect(ui->btnConexao,SIGNAL(clicked()),this,SLOT(controlConnection())); connect(socket,SIGNAL(connected()),this,SLOT(connectedServer())); connect(socket,SIGNAL(disconnected()),this,SLOT(disconnectServer())); connect(socket,SIGNAL(sentData()),this,SLOT(confirmSend())); connect(ui->btnEnviar,SIGNAL(clicked()),this,SLOT(sendData())); }
double SimulatedClient::computeResponseTime(){ _currentComputeTime =_cloudList->at(connectedServer())->computeResponseTime(_currentClientPosition); _computeTime.push_back(_currentComputeTime); return _currentComputeTime; }
void SimulatedClient::connectServer(int server){ connectedServer(server); // set current connected server _connectServerList.push_back(server); // add this server to the list of connected servers _cloudList->at(server)->getConnected(_myAddr); // ask this server to get connected }