Click here to Skip to main content
15,922,007 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi friends.

i developed a program that i want to when user connect to the internet some data be send to his email can i know that i connected to internet or not.

thank you.

Try to send it to first in your mail id for trail
Share this answer
_Starbug_ 7-Aug-14 11:43am    
this is very good answer that i see. boy first of all read question carefully after that answer it. i want to check internet connection status.i want to know i connected to the internet or not.
PIEBALDconsult 7-Aug-14 12:58pm    
Generally, that's not a very reasonable thing to do. The thing is, you can check, and maybe the check succeeds. Then the connection dies. Then you try sending and the send fails -- you have to handle that, so the check was a waste of time.
Or you check and the check fails, but then the connection recovers.

Whether you're checking for network or database or a file or disk, it's better just to try it and see whether or not it fails. Doing otherwise is just a waste of effort, in time, in development, in testing, in maintenance.

In the case you mention, what if the connection is live, but the SMTP server isn't or refuses the connection? There are a lot more things that can go wrong than just "no connection to the Internet".

Try it, and handle any Exception that results -- you have to anyway.
_Starbug_ 7-Aug-14 13:48pm    
i solved this problem my self. i want to see if the connection is open then send my file instead of send file and see that there is not any open connection. first way is smarter.
Hello ,
As far as i know you Need to use namespace.Lot of articles are being available.Check this links

Best way

a article is available on code project you can refer this:Article

Hope this can solve your problem.
Happpy Coding :-)
Share this answer
_Starbug_ 7-Aug-14 15:30pm    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900