监视你的 TCP/IP端口!!!(vb)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
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
可以搜索一下。