contents   index   previous   next



DSP dspReceive()

syntax:

dsp.dspReceive(connection, buffer, bufferLength,

               timeout)

where:

connection - The original connection that was returned from the openFunction passed to new DSP()

 

buffer - A buffer which is to be filled with data. This variable must be passed by reference (with the & operator).

 

bufferLength - The maximum amount of data to read

 

timeout - The maximum amount of time to wait (in milliseconds) for data to be ready for reading on the connection

 

return:

number - The number of bytes read, or -1 on error

 

description:

This function is responsible for getting data from the connection. This function should wait up to timeout milliseconds for data to be available on the connection. If there is no data available, then this function should return 0. Otherwise, the function should read up to bufferLength bytes from the connection and put the data into buffer. Note that this means that buffer must be passed by reference. If there is some sort of error, then this function should either throw an error, or return -1. See introduction, under creating a DSP object, for an example of how to implement this function. Note that the function need not wait for the entire buffer to be filled, it should read only as much data as is available to be read.

 

see:

#link <sedsp>, DSP dspSend()

 

 


DSP dspSend()