QString findIP = ipAdressNetwork; QString partIP,partSubNet; int ind = findIP.lastIndexOf( '.' ); partIP.append(findIP.left(ind)).append('.'); for(int i = 1; i < 254; i++) { partIP.append(partSubNet.setNum(i,10)); cltSockAWS.sockCommand->connectToHost(partIP, portCommandAWS); if (cltSockAWS.sockCommand->waitForConnected(1)) return partIP; else partIP.remove((ind+1),partIP.length()-partSubNet.length()); }