contents   index   previous   next



DSP dspSend()

syntax:

dsp.dspSend(connection, buffer, timeout)

where:

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

 

buffer - The buffer to send

 

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

 

return:

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

 

description:

This function is responsible for sending data across the connection (the one returned by the openFunction passed to the DSP constructor). Its behavior is similar to that of dspReceive(). It should wait up until timeout for data to be ready, and then send as much as possible along the connection (up to the length of buffer). If the timeout expires, the function should return 0. If there was some sort of error, then an error should be thrown, or -1 returned. Otherwise, the number of bytes written should be returned. Throwing an error is often more descriptive than the generic failure message. See introduction, under creating a DSP object, for an example of how to implement this function.

 

see:

#link <sedsp>, DSP dspReceive()

 

 


DSP dspLoad()