📄 dspsrvr.jse
字号:
//~ title: Generic File DSP Server
/*
Copyright 1999 by Ronald Terry Constant
http://www.rtconstant.com
*/
/*.
dspsrvr.jse
syntax: sewin32.exe dspsrvr.jse [infile] [outfile]
where: infile - a file specification, complete path specification,
or UNC specification, that is, infile may be a filespec,
pathspec, or network file. The parameter infile specifies the
file from which the server receives statements to execute. These
statements are sent to the server script from client scripts.
The infile for the server script corresponds to the outfile for
the client.
outfile - a file specification, complete path specification,
or UNC specification, that is, outfile may be a filespec,
pathspec, or network file. The parameter outfile specifies the
file to which the server writes statements to be received by a
client script. The outfile for the server corresponds to the
infile for the client.
desc: A generic server script run on a host computer using files to
communicate with client computers. File DSP is useful on a local
area network. The server remains running until Ctrl-C is
pressed. This script is very simple, largely for illustrative
purposes.
Note the infile and outfile parameters for both the
dspsrvr.jse and dspcli.jse scripts. These files need to
correspond. The server infile corresponds to the client
outfile, and the server outfile corresponds to the client
infile. That is, output from one script is input for the other.
Though both the server and the client specify two files, they
are the same two files, that is, only two files are created. These
files must be accessible by both the server and the client.
This script differs from its iDSP counterparts in that this
script uses files to pass information and the iDSP scripts use
Internet protocol to pass information. File DSP is simple and
useful, but is not as robust as Internet DSP.
example: // In our examples we assume that the host computer is "main"
// The interpreter executable is omitted at the beginnings
// of the command line examples (see syntax above).
// Start the file DSP server using files in the root
// directory of drive c of the host computer
dspsrvr.jse c:\dspsrvr.in c:\dspsrvr.out
// The following command line arguments would use a common
// directory on a computer named "main" in a network.
dspsrvr.jse \\main\common\dspsrvr.in \\main\common\dspsrvr.out
// The examples in dspcli.jse correspond
.*/
#include "dspfile.jsh"
function main(argc, argv)
{
// Get the in and out filespecs passed on the command line
var filFromClient = (argv[2]) ? argv[2] : "dspsrvr.in";
var filToClient = (argv[1]) ? argv[1] : "dspsrvr.out";
while (true)
{
// Establish connection and get new DSP object
var serverConnection = new fileDSP(filFromClient, filToClient);
if(serverConnection != null)
{
while(serverConnection.dspService()) ;
}
}
} //main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -