Sunday, August 2, 2009

How can i know by a c++ program if any file is being downloaded from internet to my pc?

is it possible to know by a c++ program whether any file is being downloaded from internet to my pc eighter directly or by a p2p application, if yes how?

How can i know by a c++ program if any file is being downloaded from internet to my pc?
u have two better choices and others too


but u have to either check internet bandwidth available and being used by that u can determine condition of downloading


other is to check each port that can be used during communication ie for http 80 similar for ftp, smtp and other protocols
Reply:I haven't done this myself. I have seen many programs out there on the Internet doing this. Some of my seniors also have written such programs.





Look for the program called ntop. It monitors network usage. Use that program itself or its library functions in order to get your job done. Wireshark is another such program. nmap might interest you too. But it is more of a scanner and auditing tool.
Reply:It is very hard to robustly and reliably implement this. If you monitor your network, you end up monitoring data transfer on tcp/ip or udp/ip ports. Now it's not easy to determine that the data that's transferred is really a file or anything else. Like an http request on port 80 of a web server will return file if successful, but on some port like 4421, you might be passing your user account authentication information that is not a file.





So I would recommend to narrow your needs further. Like do you want to watch a specific program what does it download? If so, try to know if that program exposes any API to monitor the program. If no, you'll need to know what network ports they are operating on and what kind of data transfer protocol they are using. Then you can set your program to monitor that port and decode the data transferred. You can use some tools like TcpView from www.sysinternals.com to monitor all of your ports.

phlox

No comments:

Post a Comment