Project

General

Profile

Sockmark » History » Version 2

Per Amundsen, 05/24/2018 10:14 AM

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
&lt;name&gt; - Socket to mark.
10
[text] - Text to add to the socket mark.
11
12
*Example*
13
14
<pre>
15
; Non-functioning example, shows practical usage only
16
on $*:text:/^!foo (\S+)$/Si:#:{
17
  ; if ( .. validate input .. ) {
18
  sockopen sock1 www.example.com 80
19
  sockmark sock1 $regml(1)
20
}
21
on *:sockopen:sock1:{
22
  ; submit the information we got from the user 
23
  sockwrite -nt $sockname GET /foobar.php?q= $+ sock($sockname).mark HTTP/1.0
24
  sockwrite -nt $sockname Host: www.example.com
25
  sockwrite -nt $sockname $crlf
26
}
27
; on *:sockread:sock1: {
28
;    ....
29
; }
30
</pre>