socksend

socksend — Sends data to other processes using the low-level UDP or TCP protocols

Description

Transmits data directly using the UDP (socksend and socksends) or TCP (stsend) protocol onto a network. The data is not subject to any encoding or special routing. The socksends opcode send a stereo signal interleaved.

Syntax

socksend asig, Sipaddr, iport, ilength
socksends asigl, asigr, Sipaddr, iport,
    ilength
stsend asig, Sipaddr, iport

Initialization

Sipaddr -- a string that is the IP address of the receiver in standard 4-octet dotted form.

iport -- the number of the port that is used for the communication.

ilength -- the length of the individual packets in UDP transmission. This number must be sufficiently small to fit a single MTU, which is set to the save value of 1456. In UDP transmissions the receiver needs to know this value

Performance

asig, asigl, asigr -- audio data to be transmitted.

Example

The example shows a simple sine wave being sent just once to a computer called "172.16.0.255", on port 7777 using UDP. Note that .255 is often used for broadcasting.

        sr = 44100
        ksmps = 100
        nchnls = 1


        instr   1
        a1 oscil        20000,441,1
           socksend     a1, "172.16.0.255",7777, 200
        endin

Credits

Author: John ffitch
2006