Click to See Complete Forum and Search --> : winsock help
zer0_flaw
Jul 14th, 2001, 10:10 PM
Alright, I want to create a program that will watch every port on the computer. I could do this with winsock but each winsock control can only watch one port... that would make me use way to many controls. Is there any API code that will let me watch a port and tell me when a connection is made to it? Or is there an easier way then 1 million winsock controls? Thanks in advance for help. Later,
-zer0 flaw
TheSarlacc
Jul 15th, 2001, 02:53 AM
1 million is a bit over the top! the exact number would be 65535!
u could do it this way! load one winsock control onto a form. name it winsock and set its index property to 0.
then type this
Private Sub Form_Load()
on error resume next
for a = 0 to 65534
load winsock(a)
winsock(a).close
winsock(a).localport = a+1
winsock(a).listen
next a
end sub
Private Sub Winsock_ConnectionRequest(Index As Integer, ByVal requestID As Long)
msgbox "Connection attempt on port " & winsock(index).localport,vbinformation
End Sub
hope this solves the problem
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.