Results 1 to 4 of 4

Thread: Port Monitor

  1. #1

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268

    Port Monitor

    Can anyone tell me how to build a VB program that would monitor ports I specify (preferably 25 & 110) and log the requests to a text file?
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Make two winsock controls, set the local ports to 25/110 respectively.

    In the connection request... close it, accept requestID, they've now established a connection. You can use the remoteip to get their IP.

  3. #3
    Addicted Member
    Join Date
    Jul 2001
    Location
    Maine
    Posts
    214
    Server End:
    VB Code:
    1. Dim strData as string
    2. Form_Load()
    3. sckWinsock.LocalPort = 25
    4. sckWinsock.Listen
    5. 'Listen for connection requests
    6. End Sub
    7.  
    8. sckWinsock_ConnectionRequest()
    9. 'Accept connection
    10. sckWinsock.Close
    11. sckWinsock.Accept RequestID
    12. End Sub
    13.  
    14. sckWinsock_DataArrival
    15. 'Gets data
    16. sckWinsock.GetData strData
    17. 'Writes to file
    18. Open App.Path & "\log.txt" for Append as #1
    19. Write #1, strdata
    20. Close #1
    21. End Sub
    22.  
    23. sckWinsock_Close
    24. MsgBox ("User has closed connection!")

    Client End:
    VB Code:
    1. Form_Load
    2. sckWinsock.RemoteHostIP = 000.000.000.000
    3. sckWinsock.RemotePort = 25
    4. End Sub
    5. cmdConnect_Click()
    6. sckWinsock.Connect
    7. End Sub
    8. 'If you want to send data, send it using sckWinsock.SendData (Variable)

    Simple, as long as you don't mess it up, which I probably did.

  4. #4

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    Thanks guys, that's exactly what I needed
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

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