shell: command not available but ok in the terminal ?

hi folks,

I’m trying to understand what’s happening here

in the open event of a new app project :

Dim theShell As New Shell
dim ch as String

theShell.Mode = 0
ch = "nmap -PN -p " + str(5432) + " " + "192.168.152.50" // or any ip existing in your network
theShell.Execute ch
Do
  App.DoEvents(25) // keep your GUI active while waiting on the shell
Loop Until Not theShell.IsRunning

MsgBox theShell.Result

running this, I get an error :

bash: nmap: command not found

if I type the command in the terminal, I get this (good) result :

macbookpro-jyp:~ jeanyves$ nmap -PN -p 5432 192.168.152.50

Starting Nmap 7.12 ( https://nmap.org ) at 2018-06-11 10:50 CEST
Nmap scan report for 192.168.152.50
Host is up (0.0059s latency).
PORT     STATE  SERVICE
5432/tcp closed postgresql

Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds

what did I miss ?

thanks.

well seems to be because nmap has to be installed, it’s not a standard command line.
it must be in the usr folders, so must have some PATH variable .
what else can I use to check if a port is open on a remote machine (for postgres server as I need now)
thanks.

finally did it with a simple tcpsocket.connect and testing for error.

what a great idea to use tcpsocket.connect to check. I am doing something similar to you Jean-Yves except for CubeSQL database server.

i am currently using ping with shell and looking at the text that is return from the shell

you cannot check for an open port with ping ? you can only check for a host to be present ?
with tcpsocket, it should be automatically cross platform :wink: