We help IT Professionals succeed at work.

need a way to test if port is open from machine a to machine b

Christopher Schene
Christopher Schene used Ask the Experts™
on
I need a way of testing whether ports are open between two devices.

I know I can us telnet in some cases, but I want something where I can actually send data from one machine to the other and verify that data.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
There may be others but you can use netstat.  here is what I get on a typical server:

C:\Program Files\Windows Resource Kits\Tools>netstat -ano

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       792
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:1043           0.0.0.0:0              LISTENING       512
  TCP    0.0.0.0:1047           0.0.0.0:0              LISTENING       1572
  TCP    0.0.0.0:1601           0.0.0.0:0              LISTENING       1756
  TCP    0.0.0.0:1787           0.0.0.0:0              LISTENING       5584
  TCP    0.0.0.0:2468           0.0.0.0:0              LISTENING       1432
  TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING       3020
  TCP    0.0.0.0:3983           0.0.0.0:0              LISTENING       904
  TCP    0.0.0.0:36364          0.0.0.0:0              LISTENING       1980
  TCP    0.0.0.0:47001          0.0.0.0:0              LISTENING       4
  TCP    10.16.148.30:139       0.0.0.0:0              LISTENING       4
  TCP    10.16.148.30:1748      10.16.148.22:135       TIME_WAIT       0
  TCP    10.16.148.30:1749      10.16.148.22:49158     ESTABLISHED     512
  TCP    10.16.148.30:1752      10.16.148.31:445       TIME_WAIT       0
  TCP    10.16.148.30:1754      10.16.148.31:389       TIME_WAIT       0
  TCP    10.16.148.30:1773      10.16.148.22:135       ESTABLISHED     512
  TCP    10.16.148.30:1774      10.16.148.22:49156     ESTABLISHED     512
  TCP    10.16.148.30:1780      10.16.148.24:139       ESTABLISHED     4
  TCP    10.16.148.30:3389      10.16.148.64:3672      ESTABLISHED     3020
  TCP    127.0.0.1:445          127.0.0.1:2448         ESTABLISHED     4
  TCP    127.0.0.1:2448         127.0.0.1:445          ESTABLISHED     4
  TCP    127.0.0.1:2469         0.0.0.0:0              LISTENING       1432
  TCP    127.0.0.1:5152         0.0.0.0:0              LISTENING       1392
  UDP    0.0.0.0:161            *:*                                    1832
  UDP    0.0.0.0:445            *:*                                    4
  UDP    0.0.0.0:500            *:*                                    512
  UDP    0.0.0.0:1078           *:*                                    1832
  UDP    0.0.0.0:1434           *:*                                    1848
  UDP    0.0.0.0:4500           *:*                                    512
  UDP    10.16.148.30:123       *:*                                    888
  UDP    10.16.148.30:137       *:*                                    4
  UDP    10.16.148.30:138       *:*                                    4
  UDP    127.0.0.1:123          *:*                                    888
  UDP    127.0.0.1:1025         *:*                                    512
  UDP    127.0.0.1:1050         *:*                                    1572
  UDP    127.0.0.1:1075         *:*                                    452
  UDP    127.0.0.1:1140         *:*                                    904
  UDP    127.0.0.1:1668         *:*                                    1756
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
That requires more than the port to be open, it requires a program or driver to listen and respond.  But that is what happens when a port is actually open.  It is not only not blocked but there is also a listener program receiving the data.

For port testing from the internet, you can use Shields Up! https://www.grc.com/x/ne.dll?bh0bkyd2 from GRC.  Or on your LAN, you can use Superscan http://www.mcafee.com/us/downloads/free-tools/index.aspx from McAfee.  Some anti-viruses will consider it a bad program, they generally don't like port scanners.
Top Expert 2013

Commented:
If you are wanting to test a particular port you might want to use a service such as remote desktop that allows you to change the port. Many services will not do so. You can use the registry change below on the computer to which you want to connect, and then connect using:
mstsc -v:PCname:<port #>
such as
mstsc -v:PCname:5000

To change RDP listening port:Start Registry Editor.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber
On the Edit menu, click Modify, and then click Decimal.
Type the new port number, and then click OK.
Quit Registry Editor.
Restart the computer.
from: http://support.microsoft.com/kb/306759
Christopher ScheneSystem Engineer/Software Engineer

Author

Commented:
Thanks all....I need a little bit of time to test out the solutions,

Thanks!
Top Expert 2013

Commented:
By the way if you want to test if a port is open, most of the above suggestions are far superior to my post http#a36345229 . However you had asked about selecting a specific port and using a service to transfer data over that specific port to manually test. In that case it is a useful option.
Top Expert 2013

Commented:
1).nmap  -v -sU -sT -sS localhost  - its for local system.
2). nmap -v -sU -sT -sS <remote system ip> - its for remote system.
Christopher ScheneSystem Engineer/Software Engineer

Author

Commented:
I tried

nmap  -v -sU -sT -sS localhost

on my win7 box and it says that it can't find the nmap command