Script to check whether a destination port is open

Hello,

I have a mikrotik with running web proxy which is setup with a parent proxy.
Also, I have setup netwatch to check the availablity of the parent proxy and to update the configuration of my web proxy to another parent if the current parent is not available.
The problem is that netwatch checks whether the parent proxy’s IP address is reachible, but it is not aware whether the port of the parent proxy is open.
In this case even if the device where the parent proxy is running is reachible, but the parent proxy itself is down, netwatch will not do a fail-over to another parent proxy.

Is it there a way I can check whether the port on which is listening the parent proxy is available?
Basically I need to check whether a destination port is open, something similar to “telnet 192.168.1.1 8080”.


Thank you.

Someone might have a better idea, but you could probably use fetch tool to test whether you could access to a website through a proxy or not, this is an example:

/tool fetch address=187.115.172.82 port=8181 host=www.mikrotik.com src-path=/resources.html mode=http

the address/port specified, is an active open proxy server at the time of writing. basically, by doing that, you are making the fetch command to request the page through that proxy. if the proxy fails, the fetch command should fail too.
Also, take a look at this thread: http://forum.mikrotik.com/t/fetch-status/51447/1

http://forum.mikrotik.com/t/fetch-status/51447/1

Sorry for being a necromancer. I also need to test if a port is open. But I cannot use fetch, because this is not http, https or ftp protocol. The fetch tool can only use these protocols. Is there way tell if a port is open in general? (I need to test TCP 6055 and UDP 6055 in particular, and I know nothing about the protocol above layer 3)

does someone know how to solve this issue ?