PDA

View Full Version : Can i make ICMP protocol to use QTcpsocket?



remnant24c@nate.com
22nd September 2009, 03:43
Hello, there.

I'd like to reviice the data of 'ping'. so onesome said "QProcess". However

I want to use QTcpsocket because of next version.

return to the subject,

Can i make ICMP protocol with QTcpsocket.

or use Winsock2 socket. I found source made by C . It used Winsock2.


If i made a struct of Ip header and icmp , how should i start init(), sendto().

thank for watching.

Have nice day.

yogeshgokul
22nd September 2009, 06:34
I'd like to reviice the data of 'ping'. so onesome said "QProcess".

The following link have what you want. Please see the post number 6 of the thread.
http://www.qtcentre.org/forum/f-qt-programming-2/t-check-ipaddress-existence-23723.html/?highlight=QProcess



Can i make ICMP protocol with QTcpsocket.
or use Winsock2 socket. I found source made by C . It used Winsock2. Yes ! Whatever you can do with Winsock can be done with QTcpSocket. But ICMP is not a part of IP stack not TCP stack. So I am not sure that it can be achievable using QTCPSocket. But Qt have several more networking classes you can use them like:
QAbstractSocket
QUdpSocket
QNetworkAccessManager



If i made a struct of Ip header and icmp , how should i start init(), sendto().
Forget point to point match of winsock and qtcpsocket. You have to implement the ICMP protocol in QTchSocket. It wors like this:
1. Connect to host
2. Put some data over socket
3. Read some data from socket
4. Disconnect

wysota
23rd September 2009, 11:53
Can i make ICMP protocol with QTcpsocket.
No, of course not.


or use Winsock2 socket. I found source made by C . It used Winsock2.
These are not TCP sockets, these are not bound to any
protocol yet, so you can bind them to any protocol, ICMP included. QTcpSocket is for handling TCP protocol.

BTW. Crafting ICMP packets may require superuser privileges.