On UDPREAD » History » Version 3
Per Amundsen, 02/10/2016 01:39 PM
1 | 1 | Per Amundsen | _Added in 2.3_ |
---|---|---|---|
2 | |||
3 | *<notextile>on <level>:UDPREAD:name:<commands></notextile>* |
||
4 | |||
5 | Triggers when there is info waiting to be read on the specified UDP connection. |
||
6 | You can read this info using the [[/sockread]] command. |
||
7 | |||
8 | 2 | Per Amundsen | _See also [[on SOCKREAD]], [[on SOCKOPEN]], [[on SOCKCLOSE]], [[on SOCKLISTEN]], [[on SOCKWRITE]], [[/sockudp]], [[$sock]], [[$sockbr]], [[$sockerr]], [[$sockname]]._ |
9 | 1 | Per Amundsen | |
10 | *Parameters* |
||
11 | |||
12 | <level> - The level for the event to trigger. |
||
13 | <name> - The UDP [[$sockname]] to listen to. |
||
14 | <commands> - The commands to be performed when the event listener's criteria is met. |
||
15 | |||
16 | *Example* |
||
17 | |||
18 | <pre> |
||
19 | on *:udpread:name:{ |
||
20 | if ($sockerr) { echo -s An error occured while trying to read data: $sock($sockname).wsmsg | return } |
||
21 | else { |
||
22 | sockread %a |
||
23 | 3 | Per Amundsen | echo -s received: %a |
24 | 1 | Per Amundsen | } |
25 | } |
||
26 | </pre> |