| 1 | |
| 2 | <refentry id="sockrecv"> |
| 3 | <indexterm id="Indexsockrecv"><primary>sockrecv</primary></indexterm> |
| 4 | <refentryinfo><title>Network</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>sockrecv</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>sockrecv</refname> |
| 11 | <refpurpose> |
| 12 | Receives data from other processes using the low-level UDP or TCP protocols |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Receives directly using the UDP (<emphasis>sockrecv</emphasis> and |
| 20 | <emphasis>sockrecvs</emphasis>) or TCP (<emphasis>strecv</emphasis>) |
| 21 | protocol onto a network. The data is not subject to any encoding or special |
| 22 | routing. The <emphasis>sockrecvs</emphasis> opcode receives a stereo signal |
| 23 | interleaved. |
| 24 | </para> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Syntax</title> |
| 29 | <synopsis>asig <command>sockrecv</command> iport, ilength</synopsis> |
| 30 | <synopsis>ksig <command>sockrecv</command> iport, ilength</synopsis> |
| 31 | <synopsis>asigl, asigr <command>sockrecvs</command> iport, ilength</synopsis> |
| 32 | <synopsis>String <command>sockrecv</command> iport, ilength</synopsis> |
| 33 | <synopsis>asig[,kstate] <command>strecv</command> Sipaddr, iport</synopsis> |
| 34 | </refsect1> |
| 35 | |
| 36 | <refsect1> |
| 37 | <title>Initialization</title> |
| 38 | <para> |
| 39 | <emphasis>Sipaddr</emphasis> |
| 40 | -- a string that is the IP address of the sender in standard |
| 41 | 4-octet dotted form. |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>iport</emphasis> |
| 46 | -- the number of the port that is used for the communication. |
| 47 | </para> |
| 48 | |
| 49 | <para> |
| 50 | <emphasis>ilength</emphasis> |
| 51 | -- the length of the individual packets in UDP transmission. |
| 52 | This number must be sufficiently small to fit a single MTU, |
| 53 | which is set to the save value of 1456. In UDP transmissions |
| 54 | the sender and receiver needs agree on this value |
| 55 | </para> |
| 56 | |
| 57 | </refsect1> |
| 58 | |
| 59 | <refsect1> |
| 60 | <title>Performance</title> |
| 61 | <para> |
| 62 | <emphasis>asig, asigl, asigr</emphasis> -- audio data to be |
| 63 | received. |
| 64 | </para> |
| 65 | <para> |
| 66 | <emphasis>ksig</emphasis> -- control data to be received. |
| 67 | </para> |
| 68 | <para> |
| 69 | <emphasis>String</emphasis> -- string data to be received. |
| 70 | </para> |
| 71 | <para> |
| 72 | <emphasis>kstate</emphasis> -- optional output to give the state |
| 73 | of the receipt. Gives the number of bytes transferred in the |
| 74 | current performance cycle or -1 if the sender has ceased writing. |
| 75 | </para> |
| 76 | |
| 77 | </refsect1> |
| 78 | |
| 79 | <refsect1> |
| 80 | <title>Example</title> |
| 81 | <para> |
| 82 | The example shows a mono signal being received on port 7777 using UDP. |
| 83 | </para> |
| 84 | <informalexample> |
| 85 | <programlisting> |
| 86 | <emphasis role="ohdr">sr</emphasis> <emphasis role="op">=</emphasis> 44100 |
| 87 | <emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 100 |
| 88 | <emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 1 |
| 89 | |
| 90 | |
| 91 | <emphasis role="oblock">instr</emphasis> 1 |
| 92 | a1 <emphasis role="opc">sockrecv</emphasis> 7777, 200 |
| 93 | <emphasis role="opc">out</emphasis> a1 |
| 94 | <emphasis role="oblock">endin</emphasis></programlisting> |
| 95 | </informalexample> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>See also</title> |
| 100 | <para><link linkend="Network"><citetitle>Network</citetitle></link></para> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>Credits</title> |
| 105 | <para> |
| 106 | <simplelist> |
| 107 | <member>Author: &namejohn;</member> |
| 108 | <member>2006</member> |
| 109 | </simplelist> |
| 110 | </para> |
| 111 | <para>kstate optional output new in 6.14</para> |
| 112 | </refsect1> |
| 113 | </refentry> |