Changeset 462 for trunk/gui/scripts/nanovisviewer.tcl
- Timestamp:
- Jun 5, 2006 9:21:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/nanovisviewer.tcl
r459 r462 34 34 itk_option define -plotoutline plotOutline PlotOutline "" 35 35 36 constructor {host port args} { # defined below }36 constructor {hostlist args} { # defined below } 37 37 destructor { # defined below } 38 38 … … 43 43 public method download {option} 44 44 45 public method connect {{host ""} {port ""}}45 public method connect {{hostlist ""}} 46 46 public method disconnect {} 47 47 public method isconnected {} … … 71 71 private variable _dispatcher "" ;# dispatcher for !events 72 72 73 private variable _nvhost "" ;# host name for nanovis server 74 private variable _nvport "" ;# port number for nanovis server 73 private variable _nvhosts "" ;# list of hosts for nanovis server 75 74 private variable _sid "" ;# socket connection to nanovis server 76 75 private variable _parser "" ;# interpreter for incoming commands … … 98 97 # CONSTRUCTOR 99 98 # ---------------------------------------------------------------------- 100 itcl::body Rappture::NanovisViewer::constructor { nvhost nvport args} {99 itcl::body Rappture::NanovisViewer::constructor {hostlist args} { 101 100 Rappture::dispatcher _dispatcher 102 101 $_dispatcher register !legend … … 412 411 eval itk_initialize $args 413 412 414 connect $ nvhost $nvport413 connect $hostlist 415 414 } 416 415 … … 590 589 591 590 # ---------------------------------------------------------------------- 592 # USAGE: connect ?<host >? ?<port>?591 # USAGE: connect ?<host:port>,<host:port>...? 593 592 # 594 593 # Clients use this method to establish a connection to a new … … 596 595 # Any existing connection is automatically closed. 597 596 # ---------------------------------------------------------------------- 598 itcl::body Rappture::NanovisViewer::connect {{host ""} {port ""}} {597 itcl::body Rappture::NanovisViewer::connect {{hostlist ""}} { 599 598 disconnect 600 599 601 if {"" != $host} { set _nvhost $host } 602 if {"" != $port} { set _nvport $port } 603 604 if {"" == $_nvhost || "" == $_nvport} { 600 if {"" != $hostlist} { set _nvhosts $hostlist } 601 602 if {"" == $_nvhosts} { 605 603 return 0 606 604 } … … 616 614 # forward us to another. 617 615 # 616 set try [split $_nvhosts ,] 617 foreach {hostname port} [split [lindex $try 0] :] break 618 set try [lrange $try 1 end] 619 618 620 while {1} { 619 if {[catch {socket $_nvhost $_nvport} sid]} { 620 return 0 621 if {[catch {socket $hostname $port} sid]} { 622 if {[llength $try] == 0} { 623 return 0 624 } 625 foreach {hostname port} [split [lindex $try 0] :] break 626 set try [lrange $try 1 end] 627 continue 621 628 } 622 629 fconfigure $sid -translation binary -encoding binary
Note: See TracChangeset
for help on using the changeset viewer.