contents   index   previous   next



DSP()

syntax:

new DSP( [openFunction[, param1[, ...]]])

where:

openFunction - The function to call to initialize the connection.

 

paramN - Additional parameters to pass to the open function

 

return:

object - A new DSP object, or null on error. This is the object that will be passed as the first parameter to all for most of the DSP methods (dspReceive, dspSend). Those methods should use the first passed parameter, and not the "this" variable, for any connection-specific properties or methods--because the dsp object is acting as a proxy to another system to use the "this" variable would instead be acting on the remote system.

 

description:

This function creates a new DSP object, or returns null on error. Note that calling this function itself accomplishes very little unless you build up an appropriate DSP object by adding open, close, and transport functions. A new DSP object can be created with just new DSP(), but it will be unusable without transport functions. See the introduction, under creating a DSP object, for more information about setting up a proper DSP object. The first optional parameter is the open function to use. Once the object has been created, this function is called with any additional parameters passed to DSP(). The result of this call is set the dspConnection member of the newly created object, and is only used to pass as the first parameters to the dspSend, dspReceive, and dspCloseConnection methods. If openFunction is supplied and returns null, then it is considered an error and the DSP construction fails.

 

see:

#link <sedsp>

 

example:

function fileOpen( filename )

{

   return Clib.fopen( filename, "wb" );

}

var connection = new DSP( fileOpen, "c:\tempfile.dat" );

// This will call fileOpen and assign the result to

// connection.dspConnection.  If it was null,

// then the DSP connection will fail

 


DSP dspCloseConnection()