sockrecv

sockrecv — Receives data from other processes using the low-level UDP or TCP protocols

Description

Receives directly using the UDP (sockrecv and sockrecvs) or TCP (strecv) protocol onto a network. The data is not subject to any encoding or special routing. The sockrecvs opcode receives a stereo signal interleaved.

Syntax

asig sockrecv iport, ilength
ksig sockrecv iport, ilength
asigl, asigr sockrecvs iport, ilength
String sockrecv iport, ilength
asig[,kstate] strecv Sipaddr, iport

Initialization

Sipaddr -- a string that is the IP address of the sender 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 sender and receiver needs agree on this value

Performance

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

ksig -- control data to be received.

String -- string data to be received.

kstate -- optional output to give the state of the receipt. Gives the number of bytes transferred in the current performance cycle or -1 if the sender has ceased writing.

Example

The example shows a mono signal being received on port 7777 using UDP.

        sr = 44100
        ksmps = 100
        nchnls = 1


        instr   1
        a1 sockrecv   7777, 200
           out        a1
        endin

See also

Network

Credits

Author: John ffitch
2006

kstate optional output new in 6.14