请问我需要测试其他机器的端口是否在线 ,用以下这种方式如果不在线的话,会有响应时间导致软件卡住,请问一下这个响应时间是否可以设置,谢谢!
Dim seip As WinForm.ComboBox = e.Form.Controls("txtIP")
Dim secode As WinForm.NumericComboBox = e.Form.Controls("txtPort")
Dim btn As WinForm.Button = e.Form.Controls("Button5")
btn.Text="连接中.."
If seip.text<>"" And secode.value<>0 Then
try
Dim tcp As New System.Net.Sockets.TcpClient
tcp.connect(seip.text, secode.value)
btn.Text="成功!"
catch ex As exception
btn.Text="失败!"
End try
End If