PxPLUS simple Client/Server
PxPLUS has developed an alternative for *NThost/*NTslave. The advantage is that
the host needs only 1 tcp socket. That is interesting if you connect via the
Internet and thus you need to open only 1 port in your firewall. PxPLUS
uses port 4093 by default. They obtained this portnumber by IANA (Internet
Assigned Numbers Authority).
To start the host.
Save this script in /usr/local/bin/starthost on your Unix machine:
#!/bin/sh
PVXLIB=/pxplus/lib
PVXFLMAP=\\/
export PVXLIB PVXFLMAP
umask 0
cd /pxplus
{su username}
/pxplus/pxplus -dr=/pxplus/ \*plus/cs/host -arg 4093 {forced program} >/dev/null </dev/null 2>&1
and change permissions with 'chmod 777'
Add this line to /etc/inittab of the Unix machine:
pxp1:2345:respawn:/usr/local/bin/starthost </dev/null >/dev/null 2>&1
[ Note for SCO OpenServer 5 users: I usually include this line below the 'r3'
line in /etc/inittab ].
Please note that when the kernel environment is rebuild (after linking a new
kernel for example), SCO will remove this line from /etc/inittab.
Save /etc/inittab and enter 'telinit q'. You've now started a PxPLUS host
program on your Unix machine (using socket 4093) that will wait for
*plus/cs/CLIENT WindX connections.
Please note that on some Unix machines, you will
need to reboot in order to have Unix accept this additional inittab line.
If you are using a Linux OS, you will notice that the inittab file is not
in
use anymore.
In order to have the script autostart when the machine boots,
you can use one of the following:
1. There's a /etc/init.d/boot.local script.
Add the following line to that script:
sudo -uuser /usr/local/bin/starthost &
2. There's a /etc/rc.d/rc.local script.
Add the following line to that script:
su user -c /usr/local/bin/starthost &
'user' is a login name from '/etc/passwd':
This user (or the one that you select) *MUST* be available in /etc/passwd.
Verify that you can login and start
PxPLUS
with this user.
If you want to start the host automatically (as a service) in a Windows
environment, use
*plus/cs/service. This program asks for a starting directory, tcp port and
which program to start. Then you need to go to 'control panel' >
'services' and change the status from 'manual' to 'automatic'.
To start a client
Create the following shortcut on your Windows desktop to make a WindX connection:
Target : C:\pxplus\pxplus.exe *plus/cs/client -id=Txx -arg xxx.xxx.xxx.xxx[;ssss] [progname]
Start in: C:\pxplus
Minimized
xxx.xxx.xxx.xxx is the IP-adres of the host machine.
ssss is the socket number the host is using. Default=4093
-id=Txx is the value of FID(0)
progname is the name of the program to start when a connection is
established. If empty, PxPLUS starts in 'console
mode'.
If you want to start PxPLUS sub-processes from this kind of connection, you
still can use CALL "*windx.utl;spawn".
|