Originally Posted by Elkvis in addition to what has already been said, you really shouldn't rely on the text of an error message. there are other (better) ways of determining which error was generated. Like catching the SocketException. http://msdn.microsoft.com/en-us/library/fkbhht5w.aspx