1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#! /bin/sh
# the next line restarts using tclsh8.5 on unix \
if type tclsh8.5 > /dev/null 2>&1 ; then exec tclsh8.5 "$0" ${1+"$@"} ; fi
# the next line restarts using tclsh85 on Windows using Cygwin \
if type tclsh85 > /dev/null 2>&1 ; then exec tclsh85 "`cygpath --windows $0`" ${1+"$@"} ; fi
# the next line complains about a missing tclsh \
echo "This software requires Tcl 8.5 to run." ; \
echo "Make sure that \"tclsh8.5\" or \"tclsh85\" is in your \$PATH" ; \
exit 1
lappend auto_path ../../orb
package require combat
itcl::class Server_impl {
public method _Interface {} {
return "IDL:Async:1.0"
}
public method sleep {seconds} {
after [expr $seconds*1000]
return $seconds
}
public method strcpy {the_dest src} {
upvar $the_dest dest
set dest $src
return [string length $src]
}
public method nop {} {
}
}
set argv [eval corba::init $argv]
source test.tcl
#
# Create a Server server and activate it
#
set poa [corba::resolve_initial_references RootPOA]
set mgr [$poa the_POAManager]
set srv [Server_impl #auto]
set oid [$poa activate_object $srv]
set reffile [open [format "server_%d.ior" [lindex $argv 0]] w]
set ref [$poa id_to_reference $oid]
set str [corba::object_to_string $ref]
puts -nonewline $reffile $str
close $reffile
#
# Activate the POA
#
$mgr activate
#
# .. and start serving requests ...
#
vwait forever
puts "oops"
|