openport hscript command
Opens a communication port to Houdini.
Usages
openport [-e] [-q] [-s] [-w] [-i ipmask] [-r unix_command] port_numberopenport [-a] [-e] [-q] [-s] [-w] [-i ipmask] [-r unix_command] [-p]openport
This allows the hcommand program to run textport commands from a remote process.
If you don’t give a port number or use the -a option, the command prints a list of ports that are currently open.
Options
-e | Commands sent to the port to output errors separately from regular output. Regular output will be sent first, followed by a line containing “~~~~~”, followed by any error messages. |
-q | (Quiet) Do not print an error message if the specified port number is already open. If you also specify -a, the command will print only the port number. |
-s | Allow the remote process to run only “safe” commands. |
-w | (Wait) Do not return until the newly created port is closed. It is the responsibility of some external application to send a closeport command through the newly opened port to close it. |
-a | Automatically choose a free port to open. Until this port is closed, calling openport -a will return the same port number. |
-r unix_command | Runs the unix command, waiting for that unix command to finish before returning. While the unix command is running, Houdini will respond to hscript commands sent to the port. When the command is finished, the port will be closed, regardless of whether it was opened with -a. If the unix command contains spaces, be sure to put it in quotes. If -a is used, use the -p option to automatically add the port number as the last argument to the unix command. |
-p | When used with the -a and -r options, this option will append the port number to the unix command that was run. For example, if the unix command was “python2.4 script.py” and 15423 is the port number chosen by -a, Houdini will run “python2.4 script.py 15423”. |
-c | This is a Windows-only option. When used with the -r option, it will pop up a window containing any output from the command that’s run. If this open is not given, no window will pop up. |
-i ipmask | The mask for IP addresses that may connect to this port. The mask is a series of one or more IP addresses, separated by commas. IP addresses are of the form xxx.xxx.xxx.xxx. Each of the four components of an IP address may be a digit, a + (plus), or a * (asterisk). If a digit is given, only ip addresses with that digit in that component may connect to the port. If a plus is given, that component of the IP address must match the current machine’s component. If an asterisk is given, that component of the IP address may be anything. The default IP mask is +.+.+.+, meaning that only the local machine may connect to the port. |
Examples
Chooses a free port and runs “python2.4 script.py <port>”, where <port> is the port number that was opened. Houdini waits for python to finish executing before returning, but it responds to commands sent over the port as it waits. When python finishes, the port is closed.openport -a -r "python2.4 script.py" -p
