Go to home page mail me! RSS Feed

August 2007 Entries

Check for internet connection

Sometimes we can't trust networks or they may be unstable and our applications usually throw an unexpected error or the unusual occurs. Here is the snippet that I use to determine if the computer that the application is running on has an active internet connection. Note the use of unmanaged code. 1: /// <summary> 2: /// Performs actions on the network 3: /// </summary> 4: public class NetworkHandler 5: { 6: // Extern Library 7: // UnManaged...

posted @ Thursday, August 30, 2007 2:09 PM | Feedback (1)

Sending email via GMail smtp server

If for some reason you need to send mail via the Google GMail SMTP server, here is how you do it. Keep in mind that the connection has to be secured and it's using an unusual port. If you have a firewall, you may want to do some re-configuration.   1: int port = 587; 2: string userName = "myemail@gmail.com"; 3: string password = "password"; 4:   5: try 6: { 7: MailMessage message = new MailMessage(); 8:...

posted @ Friday, August 24, 2007 10:00 AM | Feedback (4)

Downloading a file using pure .Net Socket

Ok,  so sometimes HttpWebRequest and WebClient does not really cut it, so you have no choice but to perform a raw download - socket is the way to go. Here is a quick and dirty way of downloading a file using socket. .Net sockets are not limited to http, you can use it to download files from different protocols.   1: // Local Variables 2: string fileName = "/en/us/default.aspx"; 3: string hostName = "www.microsoft.com"; 4: string data = string.Empty; 5: string dataFile = @"c:\temp\default.aspx"; 6: int port = 80; ...

posted @ Thursday, August 23, 2007 10:45 AM | Feedback (0)

Secret project is now live.

One of the projects that I have been working on secret is now live. Please check it out and leave feedback, good or bad - I'm open to suggestions. http://www.financify.com

posted @ Friday, August 17, 2007 11:50 AM | Feedback (0)

Next entries »