1send(n)                      Tk Built-In Commands                      send(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       send - Execute a command in a different application
9

SYNOPSIS

11       send ?options? app cmd ?arg arg ...?
12_________________________________________________________________
13
14

DESCRIPTION

16       This command arranges for cmd (and args) to be executed in the applica‐
17       tion named by app.  It returns the result or error  from  that  command
18       execution.  App may be the name of any application whose main window is
19       on the display containing the sender's main window;   it  need  not  be
20       within  the  same  process.   If no arg arguments are present, then the
21       command to be executed is contained entirely within the  cmd  argument.
22       If one or more args are present, they are concatenated to form the com‐
23       mand to be executed, just as for the eval command.
24
25       If the initial arguments of the command begin with “-” they are treated
26       as options.  The following options are currently defined:
27
28       -async Requests asynchronous invocation.  In this case the send command
29              will complete immediately without waiting for cmd to complete in
30              the  target application;  no result will be available and errors
31              in the sent command will be ignored.  If the target  application
32              is  in  the  same  process  as  the sending application then the
33              -async option is ignored.
34
35       -displayof pathName
36              Specifies that the target application's main window  is  on  the
37              display  of the window given by pathName, instead of the display
38              containing the application's main window.
39
40       --     Serves no purpose except to terminate the list of options.  This
41              option is needed only if app could contain a leading “-” charac‐
42              ter.
43
44

APPLICATION NAMES

46       The name of an application is set initially from the name of  the  pro‐
47       gram  or script that created the application.  You can query and change
48       the name of an application with the tk appname command.
49
50

DISABLING SENDS

52       If the send command is removed from an application (e.g.  with the com‐
53       mand  rename send {}) then the application will not respond to incoming
54       send requests anymore,  nor will it be able to issue outgoing requests.
55       Communication can be reenabled by invoking the tk appname command.
56
57

SECURITY

59       The  send  command is potentially a serious security loophole. On Unix,
60       any application that can connect to your X server can send  scripts  to
61       your  applications.   These  incoming  scripts  can use Tcl to read and
62       write your files and invoke subprocesses under your  name.   Host-based
63       access control such as that provided by xhost is particularly insecure,
64       since it allows anyone with an account on particular hosts  to  connect
65       to your server, and if disabled it allows anyone anywhere to connect to
66       your server.  In order to provide at least a small amount of  security,
67       Tk  checks  the  access  control  being  used by the server and rejects
68       incoming sends unless (a) xhost-style access control is  enabled  (i.e.
69       only  certain  hosts  can  establish  connections)  and (b) the list of
70       enabled hosts is empty.  This means that applications cannot connect to
71       your  server  unless  they use some other form of authorization such as
72       that provide by xauth.  Under  Windows,  send  is  currently  disabled.
73       Most of the functionality is provided by the dde command instead.
74

EXAMPLE

76       This  script fragment can be used to make an application that only runs
77       once on a particular display.
78              if {[tk appname FoobarApp] ne "FoobarApp"} {
79                  send -async FoobarApp RemoteStart $argv
80                  exit
81              }
82              # The command that will be called remotely, which raises
83              # the application main window and opens the requested files
84              proc RemoteStart args {
85                  raise .
86                  foreach filename $args {
87                      OpenFile $filename
88                  }
89              }
90

KEYWORDS

92       application, dde, name, remote execution, security, send
93
94
95
96Tk                                    4.0                              send(n)
Impressum