Hey, does anyone know how to close a port/ports?
If so then could you please post how?
Thanks in advance.
Closing Ports! - Help
Started by travy92, Sep 07 2007 02:56 AM
20 replies to this topic
#1
Posted 07 September 2007 - 02:56 AM
|
|
|
#2
Posted 07 September 2007 - 08:20 AM
Make a winsock control on your form. Then set it to listen to a specific port, on connection request, set it to close. Example:
Private Sub Form_Load()
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Private Sub Form_Load()
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Option Explicit
:cool:
:cool:
#3
Posted 07 September 2007 - 04:43 PM
o0TheNerd0o said:
Make a winsock control on your form. Then set it to listen to a specific port, on connection request, set it to close. Example:
Private Sub Form_Load()
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Private Sub Form_Load()
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Port = 2314
Winsock1.Listen
End Sub
So if i opened visual basic, made a win sock control and added that code, it would close my port permanently? Or just close it until i close Visual basic?
That's what i need.
#4
Posted 07 September 2007 - 04:44 PM
#5
Posted 07 September 2007 - 04:52 PM
Oh ok, thanks.
Now i'll just make it run on start-up and then make it in system tray and then i'm done.
Thanks so much!
Now i'll just make it run on start-up and then make it in system tray and then i'm done.
Thanks so much!
#6
Posted 07 September 2007 - 04:54 PM
If the port is open this won't work though. So "blocking" would be the wrong word to use. If it isn't open it is already blocked.
Also, by opening the ports you can create a port scanner (for your local machine). If you open the port and receive an exception the port is open. Just thought I would throw that in there.
Also, by opening the ports you can create a port scanner (for your local machine). If you open the port and receive an exception the port is open. Just thought I would throw that in there.
#7
Posted 07 September 2007 - 04:56 PM
You're welcome. I hope it works. Lop is correct for the most part. Its not really "blocking" the port, it just denies connection requests.
Option Explicit
:cool:
:cool:
#8
Posted 07 September 2007 - 04:59 PM
Is it possible to get as low as intercepting packets with VB?
#9
Posted 07 September 2007 - 05:04 PM
I'm sure it is. I've never done it. I used the methodology when blocking aim direct connect requests. It worked great. So I'm not exactly sure if its packet level or not.
Option Explicit
:cool:
:cool:
#10
Posted 07 September 2007 - 05:14 PM
So basically Travy92, you would need to load this application before any other apps open the ports you want to block. Is that how you did it TheNerd?
#11
Posted 07 September 2007 - 05:16 PM
Kind of... It doesn't really matter when you load the application. It will listen on the port regardless. And when a connection request comes in, it will close it then set itself to listen again.
Option Explicit
:cool:
:cool:
#12
Posted 07 September 2007 - 10:03 PM
Ummm, how would i load it before any other app?
Would i use like a .bat file to execute it with autoexec? Or something like that?
EDIT: Oh and what do you mean "make a winsock control" on your form?
Do you mean ctrl+T>Microsoft Winsock controls 6.0?
Or?
P.S - When i click Ctrl+T>Microsoft Win sock Controls 6.0 and then the button that looks like a computer with a red cable to another computer (On the tool bar to the left of the Form) and try to add it to the form it says:
"License information for this component not found. You do not have an appropriate license to use this functionality in this environment."
Help?
Would i use like a .bat file to execute it with autoexec? Or something like that?
EDIT: Oh and what do you mean "make a winsock control" on your form?
Do you mean ctrl+T>Microsoft Winsock controls 6.0?
Or?
P.S - When i click Ctrl+T>Microsoft Win sock Controls 6.0 and then the button that looks like a computer with a red cable to another computer (On the tool bar to the left of the Form) and try to add it to the form it says:
"License information for this component not found. You do not have an appropriate license to use this functionality in this environment."
Help?


Sign In
Create Account


Back to top









