Results 1 to 2 of 2

Thread: winsock help

  1. #1

    Thread Starter
    Hyperactive Member zer0_flaw's Avatar
    Join Date
    Apr 2001
    Posts
    448

    winsock help

    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

  2. #2
    TheSarlacc
    Guest
    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

    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width