Sockmark » History » Version 3
Per Amundsen, 02/16/2023 03:19 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | */sockmark <name> [text]* |
||
4 | |||
5 | 2 | Per Amundsen | Assigns temporary data to a socket to be referenced later using [[$sock]](<name>).mark. Leaving the [text] parameter $null will clear the socket mark. The sockmark command can be used to assign the same data to multiple sockets using a [[Scripting_Wildcards|wildcard]] pattern. |
6 | 1 | Per Amundsen | |
7 | *Parameters* |
||
8 | |||
9 | 3 | Per Amundsen | table(ktable). |
10 | |*Parameter*|*Description*| |
||
11 | | <name> | Socket to mark. | |
||
12 | | [text] | Text to add to the socket mark. | |
||
13 | 1 | Per Amundsen | |
14 | *Example* |
||
15 | |||
16 | <pre> |
||
17 | ; Non-functioning example, shows practical usage only |
||
18 | on $*:text:/^!foo (\S+)$/Si:#:{ |
||
19 | ; if ( .. validate input .. ) { |
||
20 | sockopen sock1 www.example.com 80 |
||
21 | sockmark sock1 $regml(1) |
||
22 | } |
||
23 | on *:sockopen:sock1:{ |
||
24 | ; submit the information we got from the user |
||
25 | sockwrite -nt $sockname GET /foobar.php?q= $+ sock($sockname).mark HTTP/1.0 |
||
26 | sockwrite -nt $sockname Host: www.example.com |
||
27 | sockwrite -nt $sockname $crlf |
||
28 | } |
||
29 | ; on *:sockread:sock1: { |
||
30 | ; .... |
||
31 | ; } |
||
32 | </pre> |