这个系统带DOS命令怎么用VB表达出来?
判断服务器某个端口是否开启 在XP系统命令符里用 这种方式表达 start /min telnet 58.215.117.59 30810,命令符窗口就会自动出来一个最小化的窗口,如果30810端口是开启的就不会自动关闭,如果这个端口是关闭的,过一会最小化的窗口就会关闭,每次手动输入很麻烦。有没有什么办法用VB编写一个程序,求代码,谢谢。
Option Explicit Dim ifConnect As Boolean Dim refuse As Boolean Private Sub Form_Load() Form1.Show Winsock2.LocalPort = 5000 Winsock2.Listen Winsock1.Protocol = sckTCPProtocol Winsock1.LocalPort = 5001 Winsock1.Connect "127.0.0.1", 5000 Do DoEvents Loop Until refuse Or ifConnect If refuse Then Form1.Caption = "强行拒绝" Winsock1.Close Winsock2.Close End If End Sub Private Sub Form_Unload(Cancel As Integer) Winsock1.Close Winsock2.Close End Sub Private Sub Winsock1_Connect() ifConnect = True Form1.Caption = "已连接" End Sub Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) If Number = 10061 Then refuse = True End Sub