Categories
Knowledge Support Cloudvue exacqVision EDGE Support exacqVision Enterprise exacqVision Client exacqVision Server exacqVision Webservice Categories exacqVision Hardware Products exacqVision Integrations

PortCheck Utility

When troubleshooting TCP/IP connectivity issues, it is often helpful to confirm that the network path is open over a specified port and that there is no interference from a firewall or antivirus. This also rules out software level problems that may be causing a failure to connect.

While there exists many utilities to accomplish this task (telnet, putty, nmap, etc…), often these utilities aren’t previously isntalled and can’t be accessed when troubleshooting.

This utility will attempt to make a TCP connection to a specified IP Address or hostname over a specified port and return either success or failure.

PortCheck – Windows

PortCheck.bat

If you are unable to transfer the file, the contents can be copy and pasted into a file manually and run from command line.

::PortCheck.bat
::This utility will check the network path to the specified IP address/Hostname.
::It will accept the first argument as the IP Address/Hostname, and the second argument as the port.
::Author - Isaac Penrod

@echo off

set $IP=%1
set $PORT=%2

IF "%~1" == "" set /p $IP="Enter the IP Address or Hostname: "
IF "%~2" == "" set /p $PORT="What TCP Port: "
set $COMMAND="^(New-Object System.Net.Sockets.TcpClient^).ConnectAsync^('%$IP%', '%$PORT%'^).Wait^(800^)"
echo.
echo Checking connectivity to %$IP%:%$PORT%
echo If the network path is open and something is listening at that location, the result will be "True"
echo.
powershell -command " %$COMMAND% "
echo.
pause

PortCheck – Linux

portcheck.sh

If you are unable to transfer the file, the contents can be copy and pasted into a file manually and run from terminal.

You will also need to make the file executable with – chmod +x portcheck.sh

#!/bin/bash
#This utility will check the network path to the specified IP address/Hostname.
#It will accept the first argument as the IP Address/Hostname, and the second argument as the port.
#Author Isaac Penrod

IP=$1
PORT=$2

if test -z "$IP"
then
read -p "Enter the IP Address or Hostname: " IP
fi

if test -z "$PORT"
then
read -p "What TCP Port: " PORT
fi

echo
echo Checking connectivity to $IP:$PORT
echo If the network path is open and something is listening at that location, the result will be "success"
echo
timeout 2 bash -c 'if > /dev/tcp/'$IP'/'$PORT'; then echo success; fi'
if [ $? != "0" ]; then
echo failure
fi
echo

Arguments

This utility will also accept command line arguments.
$1 – IP Address/Hostname
$2 – Port