OpenVMS Source Code Demos

DECNET_DEMO_S.COM

$	set ver				! send output to NETSERVER.LOG
$!===========================================================================
$! title  : decnet_demo_s.com (decnet demo server)
$	goto skip_comments
$! author : Neil Rieck
$! created: 2011-08-02
$! notes  :
$! 1. this program is started by a DECnet message from another node
$! 2. it receives a message then echos it back
$! 3. script output goes to NETSERVER.LOG (only in network mode)
$! 4. do not redefine sys$output to sys$net
$! 5. do not redefine sys$input to sys$net
$!===========================================================================
$skip_comments:
$	say :== write sys$output	!
$	if f$mode() .nes. "NETWORK"	!
$	then				!
$		say "-e- not NETWORK mode so exiting"
$		set nover		!
$		exit			!
$	endif				!
$!
$!	sho log/proc *
$!
$	set on				!
$	open/read/write/error=open_error client sys$net
$	read/error=read_error/end_of_file=my_eof client buffer
$	say "-i-received: ",buffer	!
$	msg = "you sent: "+ buffer	!
$	write client msg		!
$fini:					!
$	set noon			!
$	close client			!
$	logoutnow			!
$	exit				!
$!
$open_error:
$	say "-e- open error"
$	goto fini
$read_error:
$	say "-e- read error"
$	goto fini
$my_eof:
$	say "-w- EOF"
$	goto fini