Oh and just because the ping takes more time does not mean it is not useful.
Printable View
Oh and just because the ping takes more time does not mean it is not useful.
How is it useful, other than as a network admin?
A funny thing happened on my way to a debate:
Code:Dim srvrName As String = "mail.foo.bar"
Dim smtpserver As New Net.Mail.SmtpClient(srvrName)
Dim mailMessage As System.Net.Mail.MailMessage
Private Sub foobar()
'The argument for PING
Try
If My.Computer.Network.Ping(srvrName) Then
smtpserver.Send("[email protected]", "[email protected]", "jjj", "jdfo")
MessageBox.Show("Mail sent successfully")
Else
MessageBox.Show("Could not ping someaddress")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
'Exit Sub
End Try
'The opposing view - the one I support
Try
smtpserver.Send("[email protected]", "[email protected]", "jjj", "jdfo")
MessageBox.Show("Mail sent successfully")
Catch ex As Exception
If Not ex.InnerException Is Nothing Then
MessageBox.Show(ex.InnerException.Message)
Else
MessageBox.Show("Failure sending mail")
End If
'Exit Sub
End Try
End Sub