--------监视你的 TCP/IP端口!!!(vb)-----------

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 wujp1976 的 blog


      option explicit

      const portschecked = 200

      private sub command1_click()
         timer1.enabled = true
         timer1.interval = 1000
      end sub

      private sub command2_click()
         timer1.interval = 0
         timer1.enabled = false
      end sub

      private sub timer1_timer()
         dim x as integer

         list1.clear
         for x = 1 to portschecked
            doevents
            text1.text = x
            winsock1.localport = x
            on error resume next
            winsock1.listen  ' if we get an error, the port is busy.
            if err.number = 10048 then
               list1.additem x  ' log active port # to list box.
               err.number = 0
            end if

            winsock1.close
         next x
      end sub

      private sub form_load()
         label1.caption = "checking port #"
         label2.caption = "ports in use"
         command1.caption = "start"
         command2.caption = "end"
         text1.locked = true
      end sub 

本文关键:TCP/IP
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top