Actions
$sockerr » History » Revision 1
Revision 1/2
| Next »
Per Amundsen, 08/12/2015 06:22 PM
Added in 1.9.0
$sockerr
Returns any error during a socket command or socket event.
Example
; Open a socket connection to 'google.com' port '80'. alias Example { /sockopen Example www.google.com 80 ; Check if there was an error. if ($sockerr) { echo -ag There was an error: $sockerr } } ; Listen for the on SOCKOPEN event. on *:SOCKOPEN:Example:{ ; Write a GET request. sockwrite -nt $sockname GET / HTTP/1.0 sockwrite -n $sockname ; Check if there was an error. if ($sockerr) { echo -ag There was an error: $sockerr } } ; Listen for the on SOCKREAD event. on *:SOCKREAD:Example:{ ; Check if there was an error. if ($sockerr) { echo -ag There was an error: $sockerr } ; Create a local variable to hold the data. var %i ; Read the data waiting into the local variable. sockread %i ; Print data read. echo -ag Data = %i }
Updated by Per Amundsen over 9 years ago · 1 revisions