(LOGO.JPG) Python for OpenVMS

This is a very simple example of using DECnet transparent task-to-task communication. There is no error checking in the code.

This demo requires several files. Put DTSERVER.COM + DTSERVER.PY into the remote user's login directory. Make sure that the logical name PYTHON_VMS is defined when DTSERVER.COM is called.

See 'logical names' in the 'preparations' section of the 'Installation Manual'.


#$% DTCLIENT.PY
# -----

import getpass, os, pyvms, sys

print "Enter Username: ",
username = sys.stdin.readline()
username = username [:-1] # strip off trailing NEWLINE

password = getpass.getpass ("Enter Password: ")

print "Opening connection to remote system ..."

filename = '0"%s %s"::"TASK=DTSERVER"' % (username, password)

fd = pyvms.crtl_open (filename, os.O_RDWR, 0777, ('ctx=rec',))

print "I send", username
os.write (fd, username)   # send data to server
data = os.read (fd, 999)  # get answer from server
os.close (fd)             # close DECnet link
print "Received:",data    # show answer

# -----
#%$


$!#$% DTSERVER.COM
$!# -----
$ set noVERIFY
$ @ PYTHON_VMS:SETUP
$ python dtserver.py
$ exit
$!# -----
$!#%$


#$% DTSERVER.PY
# -----

import os, pyvms

fd = pyvms.crtl_open ('SYS$NET:', os.O_RDWR, 0777, ('ctx=rec',))
data = os.read (fd, 999)
print '@',data,'@'             # this goes into NETSERVER.LOG
os.write (fd, 'Hello ' + data) # send back
os.close (fd)                  # close DECnet link

# -----
#%$


Example run:

$ python DTCLIENT.PY
Enter Username: zessin
Enter Password:             [not visible]
 Opening connection to remote system ...
I send zessin
Received: Hello zessin

$


(go to: table of contents, index)

11-JUN-2000 ZE.