$sockname » History » Version 2
Per Amundsen, 08/12/2015 06:15 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$sockname* |
||
4 | |||
5 | Returns the name of a socket during [[on SOCKCLOSE]], [[on SOCKLISTEN]], [[on SOCKOPEN]], [[on SOCKREAD]] and [[on SOCKWRITE]] [[Scripting_Events|events]]. |
||
6 | |||
7 | *Example* |
||
8 | |||
9 | <pre> |
||
10 | ; Open a socket connection to 'google.com' port '80'. |
||
11 | /sockopen Example www.google.com 80 |
||
12 | |||
13 | 2 | Per Amundsen | ; Listen for the on SOCKOPEN event. |
14 | 1 | Per Amundsen | on *:SOCKOPEN:*:{ |
15 | 2 | Per Amundsen | ; Print the name of the socket. |
16 | echo -ag Sockname is $sockname |
||
17 | 1 | Per Amundsen | |
18 | 2 | Per Amundsen | ; Close the socket. |
19 | sockclose $sockname |
||
20 | } |
||
21 | 1 | Per Amundsen | </pre> |