# WindX: NTHost and NTSlave

> Source: https://manual.pvxplus.com/windx/nthost

The NTHost/NTSlave Client-Server environment consists of two distinct elements:

|  |  |  |
| --- | --- | --- |
|  | **\*NTHost** | Host/Server process |
|  | **\*NTSlave** | Client/Workstation process |

On the host computer, the program \*NTHost is run to monitor incoming requests from client PCs and to initiate new processes to service these requests. Whenever a new request comes it will launch a new instance of PxPlus which the workstation will ultimately connect to.

On the client computer system, the program \*NTSlave begins the initial connection to the host by requesting a new session to be started. Once the session is started, \*NTHost will send back the TCP/IP port number to the new process. This port number is used by \*NTSlave, which connects to this process then passes control to WindX to handle all of the terminal and graphical user interface interactions.

For the initial connection between \*NTHost and \*NTSlave to be established, \*NTSlave must know the port number that \*NTHost is monitoring. By default, this is port number 10000; however, it can be changed in the Command line used to start both programs.

As \*NTHost initiates new processes, it assigns new port numbers in increments starting with the port number one higher than the \*NTHost port assignment. By default, up to a maximum of 1000 sequential port numbers can be assigned.

***Using SSL/TLS***

\*NTHost can be set up to use SSL/TLS using the **-SSL**=*pathtocert* Command line argument. On Windows, this argument can be in any order. On UNIX/Linux, it can be any argument after the third argument.

\*NTSlave can be set up to use SSL/TLS using the **-SSL** Command line argument that can be in any order.

See **[SSL/TLS Security Certificates](https://manual.pvxplus.com/ssl-tls-certificates)**.

## \*NTHost Setup

***Microsoft Windows***

To run \*NTHost on a Windows PC, set up a shortcut with the following Command line:

C:\\pxplus\\pxplus.exe -BKG \*nthost *(assuming C:\\pxplus is where PxPlus is installed)*

Three optional arguments that can be supplied are as follows:

- The port number that \*NTHost is to monitor (and the clients to connect to)
- The maximum port number to use for connections
- The ability to request using the TCP/IP KEEPALIVE functionality

These can be specified in the Command line as program arguments.

***Example:***

C:\\pxplus\\pxplus.exe -BKG \*nthost -ARG 10000 11999 -k

These arguments direct \*NTHost to monitor socket 10000 and assign spawned sessions to port numbers 10001 through 11999. If no arguments are specified, then \*NTHost monitors port 10000 and assigns port numbers 10001 through 10999. Each session employs the TCP/IP KEEPALIVE functionality to periodically send commands to a connection to ensure that it is still active.

To run \*NTHost, simply launch this shortcut or place it in the PC's Windows Start_up folder to have it run each time the machine is restarted.

During the software installation process, the Windows installer will create a shortcut for \*NTHost automatically.

***Running as a Windows Service***

If you want to run \*NTHost as an NT service, you can use the program *srvany.exe* that comes with the NT Resource Kit from Microsoft. Once *srvany.exe* is installed, use *instsrv.exe* to define your service to NT. See the Microsoft NT Resource Kit for additional details on this process.

Note:  
On Windows, it is important to include the -BKG options on the Command line. If omitted, the \*NTHost process itself will occupy a user slot on your system thus reducing the number of potential active users your system can run. The -BKG parameter should immediately follow the .exe pathname.

***UNIX/Linux Setup***

Setting up \*NTHost on UNIX is a little more complicated and involves changing the system process 'inittab'. ***This should only be done by someone who is knowledgeable in UNIX***.

To run \*NTHost as a UNIX service, add a line similar to the following to the system '*inittab*' file (usually in the directory */etc/*):

*pvx1:235:respawn:/pxplus/pxplus \\\*nthost* -ARG port *uid umask* >/dev/null \</dev/null

***Where:***

|  |  |  |
| --- | --- | --- |
|  | *pvx1:235:respawn* | '*inittab*' parameters that cause UNIX to spawn \*NTHost at all normal execution levels and keep it running.<br>Note:  <br>The values 235 may vary based on the OS (generally 235 works for most Linux systems). |
|  | */pxplus/pxplus* | Location of the PxPlus executable. |
|  | *\\\*nthost* | Name of \*NTHost program name.<br>Note:  <br>The leading backslash is needed to avoid UNIX/Linux treating the asterisk as a wildcard for file name pattern matching. |
|  | *uid* | UNIX User ID used by the spawned process. This must be the ***name*** of the User ID, ***not*** the UID number (e.g. root). |
|  | *umask* | '*umask*' setting for all spawned tasks used when creating files. (The *umask* value is used to define file permissions.) |

Three optional parameters that may be specified after the *umask* value are as follows:

- The maximum port number to assign to the spawned sessions
- A -V which indicates that debugging information is to be sent to the system console
- A -K that activates the TCP/IP KEEPALIVE functionality

Note:  
On UNIX, it is important to include the input/output redirection to /dev/null on your Command line. If omitted, the \*NTHost process itself will occupy a user slot on your system thus reducing the number of potential active users your system can run.

***UserID*** ***Field on UNIX/Linux***

When the \*NTHost launches new sessions, it does so via an 'su' command. This ensures that applications do not run as root (which maintains system security).

Since the host program will be spawned from the '*inittab*', it will be running with full 'root' privileges. This means that the host is capable of running any application, and can utilize 'su' to launch an application under another user ID.

Special care must be taken when using 'su'. The user ID chosen must be valid and the password must not have expired. If applications refuse to launch, then it is likely that the password for the user ID has expired, or there is an administrative lock on the account. The user account should not launch anything automatically via its profile since the new session picks up the characteristics of the user id being used.

Note:  
When running under an OS such as IBM AIX, characteristics such as umask in the user's account setup may need to be modified, as they will override the Command line arguments.  
  
Another potential problem is the number of processes a single user may run. Since all applications are spawned as this user, the kernel may need to be re-tuned to increase the number of processes per user.

## \*NTSlave Setup

***Microsoft Windows Workstation Setup***

Assuming *C:\\pxplus* is where PxPlus is installed, the \*NTSlave client Command line would appear as follows:

C:\\pxplus\\pxplus.exe \*ntslave -arg *server prog port#*

***Where:***

|  |  |  |
| --- | --- | --- |
|  | *server* | This is either the IP address or host name of the host system where \*NTHost is running. |
|  | *prog* | Contains the name of program to run. If no program name is specified, then a console mode session will be started for development purposes. |
|  | *port* | TCP/IP Socket Number that the \*NTHost is monitoring. |

The \*NTSlave program will connect to any server running \*NTHost, whether it is Windows or UNIX. This makes it possible to have many shortcuts connecting to different servers, all running at the same time.
