Can we do IP scanning using QT
-
@ManiRon Alternative is service discovery (or UDP broadcast, after broadcast you can do TCP as usual)...
-
@jsulm said in Can we do IP scanning using QT:
But for UDP broadcast i might have to implement some coding on my server side , which i might not be able to do . whether we can use UDP broadcast without modifying the server side
-
@ManiRon Can't you give your server a DNS name? And then simply connect to that name instead of an IP?
-
@jsulm said in Can we do IP scanning using QT:
connectToHost
I passed an URL but the client is not connecting to the server,
client side :
QTcpSocket *tcpSocket; tcpSocket->connectToHost("www.test.com", 6547);
server side :
QTcpServer *tcpServer; tcpServer->listen(QHostAddress::Any, 6547)
-
@jsulm said in Can we do IP scanning using QT:
connectToHost
I passed an URL but the client is not connecting to the server,
client side :
QTcpSocket *tcpSocket; tcpSocket->connectToHost("www.test.com", 6547);
server side :
QTcpServer *tcpServer; tcpServer->listen(QHostAddress::Any, 6547)
@ManiRon Alright, this may be a silly solution offer, sorry for that, but you can start a process that prints your public IP address to a file, and laterly, you can assign the file as a string?
QProcess process; process.start("curl ifconfig.me > ipaddress"); //Saves the public IP address as the file "ipaddress" //You may delete the file with another process if you want. QString fname="ipaddress"; QFile file(fname); QString ip; if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ QTextStream stream(&file); while (!stream.atEnd()){ ip = stream.readLine(); } } file.close();
So, on a Linux based system, the string variable "ip" must be your public IP address.
-
@jsulm said in Can we do IP scanning using QT:
connectToHost
I passed an URL but the client is not connecting to the server,
client side :
QTcpSocket *tcpSocket; tcpSocket->connectToHost("www.test.com", 6547);
server side :
QTcpServer *tcpServer; tcpServer->listen(QHostAddress::Any, 6547)
-
@ManiRon Alright, this may be a silly solution offer, sorry for that, but you can start a process that prints your public IP address to a file, and laterly, you can assign the file as a string?
QProcess process; process.start("curl ifconfig.me > ipaddress"); //Saves the public IP address as the file "ipaddress" //You may delete the file with another process if you want. QString fname="ipaddress"; QFile file(fname); QString ip; if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ QTextStream stream(&file); while (!stream.atEnd()){ ip = stream.readLine(); } } file.close();
So, on a Linux based system, the string variable "ip" must be your public IP address.
-
@jsulm said in Can we do IP scanning using QT:
@closx He needs the IP of his server which not necessarily runs on same machine...
Then we can replace the code with
QProcess process; process.start("dig +short test.com > ipaddress"); QString fname="ipaddress"; QFile file(fname); QString ip; if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ QTextStream stream(&file); while (!stream.atEnd()){ ip = stream.readLine(); } } file.close();
Didn't I still get the main problem? Am I retarded? lmao
-
@jsulm said in Can we do IP scanning using QT:
@closx He needs the IP of his server which not necessarily runs on same machine...
Then we can replace the code with
QProcess process; process.start("dig +short test.com > ipaddress"); QString fname="ipaddress"; QFile file(fname); QString ip; if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ QTextStream stream(&file); while (!stream.atEnd()){ ip = stream.readLine(); } } file.close();
Didn't I still get the main problem? Am I retarded? lmao
-
-
@ManiRon Read the manual of your server or OS.
For Ubuntu Linux for example see https://www.cyberciti.biz/faq/ubuntu-change-hostname-command/ -
@ManiRon Read the manual of your server or OS.
For Ubuntu Linux for example see https://www.cyberciti.biz/faq/ubuntu-change-hostname-command/ -
@ManiRon
Its very easy to find on google
https://www.cnet.com/how-to/how-to-change-your-computers-name-in-windows-10/
Make sure it matches the Windows OS you are using. -
@ManiRon
Its very easy to find on google
https://www.cnet.com/how-to/how-to-change-your-computers-name-in-windows-10/
Make sure it matches the Windows OS you are using.