CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Dodge City Kansas
    Posts
    23

    Blocking ports in VB can it really be done?

    I've been told there is noway to block network ports in VB, is this a fact?

    Thanks!

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477
    It depends on how you want to block them. If you want to prevent servers to be run, you can block a port by using it yourself. The easiest way to do this is to open the port yourself using a winsock control, and just ignore the connectionrequest event.

    Code:
    Winsock1.LocalPort = 80 ' say we want to block port 80 to prevent the user from running a webserver
    Winsock1.Listen
    If you want to prrevent the user from making connections to a specific port (say you want to block the users from making a connection to port 12345, you'll have to dive into API. I've seen an example somewhere (I believe it was at www.vbip.com, not sure) that listed all the open connections, also giving an handle. You would use that handle to close the connection. I can't give you an example of this, because I've never done this myself.
    Tom Cannaerts
    email: cakkie@cakkie.be.remove.this.bit
    www.tom.be (dutch site)

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

Featured