Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to write a VBA code to check whether TCP port (e.g.3306) isblocked or not?

Hi,

Can anyone please help me to find out a way to check whether a local TCP Outbound/Inbound blocked or not? Many thanks in advance!

Best regards
Ratheesh
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default How to write a VBA code to check whether TCP port (e.g.3306) is blocked or not?

Hi,

Can anyone please help me to find out a way to check whether a local
TCP Outbound/Inbound blocked or not? Many thanks in advance!

Best regards
Ratheesh


Perhaps...

http://www.example-code.com/vb/tcp-socket-connect.asp

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to write a VBA code to check whether TCP port (e.g.3306) isblocked or not?

Hi Garry,

Thanks for your help! goes a very long way.

Finally I found a way to get the TCP port status, I hope this would help someone.

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
Set objPort = CreateObject("HNetCfg.FwOpenPort")

objPort.Port = YourPortNumber

Then check whether it is enabled or not - objPort.Enabled

Hope this will help

Best regards
Ratheesh
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default How to write a VBA code to check whether TCP port (e.g.3306) is blocked or not?

Or simply...


Function IsTcpEnabled(Optional PortNum&) As Boolean
If PortNum = 0 Then PortNum = 119 '//edit to actual
With CreateObject("HNetCfg.FwOpenPort")
.Port = PortNum: IsTcpEnabled = .Enabled
End With
End Function

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default How to write a VBA code to check whether TCP port (e.g.3306) is blocked or not?

Note that this only 'assigns' a port#, and returns whether or not that
port# is enabled. It does not tell you if an existing port# on
'localhost' is enabled!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to write a VBA code to check whether TCP port (e.g.3306) isblocked or not?

Ok.
Actually I need to check the Incoming Port 3306(MySQL) to get a key. If that disabled, I need to open the port for a limited time and get the information.

Many thanks!
Ratheesh
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using code to communicate with com1 serial port NDBC Excel Programming 1 October 10th 09 10:43 AM
How do I write formula to check a range of cells? Tayo Excel Worksheet Functions 5 August 27th 09 05:53 PM
Clean up code and port to Mac AndyC812 Excel Programming 0 June 25th 08 07:58 PM
Capturing Data from a Com Port or Printer Port Newby :) Excel Programming 3 August 19th 05 01:54 PM
Read/write a Serial Port Wal[_2_] Excel Programming 5 November 26th 04 04:26 PM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"