8
The
–e
argument allows the user to input Lua source to be run immediately. It is different than
interactive mode in that it does not give the user a different command prompt in the scripting
socket and more importantly once the command(s) is complete the Lua state is lost. In other
words, variables, loaded libraries and other constructs that are normally valid from one command
to the next are only available during that one command.
2.1.9
Socket?
The
socket?
command will return an ASCII ‘1’ if the scripting socket interface is available and
an ASCII ‘0’ if not. Further passing the
–p
argument will return the TCP/IP port of the scripting
socket interface. Note that the –p argument will return a port number regardless of whether or
not the scripting socket is available.
socket? [options]
options:
-p
returns the port number of the raw socket interface
It is useful to send the
socket?
command via the VXI-11 or raw socket interface to determine if
the scripting socket interface is available and to determine at which TCP/IP port to connect to it.
2.1.10
Upload
The
upload
command is used to upload a script from a host computer to the EM405-8. An
upload port must be specified.
upload [options] <script> <port>
options:
-x
execute the script after upload
-o
overwrite the script if the file exists
Upon receiving the
upload
command, the EM405-8 will first determine if a script of the same
name already exists. If the EM405-8 finds a script of the same name and the
–o
is not provided a
4-byte negative acknowledge (“nck\n”) is returned. If it does not find a script of the same name
or if the –o option is provided, a 4-byte positive acknowledge (“ack\n”) is returned. The
acknowledge, whether it is positive or negative, is sent via the same interface from which the
command was received.
If a positive acknowledge is returned the, EM405-8 will launch a small TCP/IP server at the
specified port. The host application must then connect to this server to upload the script. The
TCP/IP server will automatically exit once the script has been uploaded. Therefore, a new
upload
command must be used for each script to be uploaded.
The host computer must send the script in a raw format preceded with 4 bytes specifying the size
of the file as shown in Figure 3. Figure 3 also shows the simple procedure to upload the file.