$sockname » History » Version 1
Per Amundsen, 08/12/2015 06:14 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 | on *:SOCKOPEN:*:{ |
||
| 14 | ; Print the name of the socket. |
||
| 15 | echo -ag Sockname is $sockname |
||
| 16 | |||
| 17 | ; Close the socket. |
||
| 18 | sockclose $sockname |
||
| 19 | </pre> |