From WikiChip
Difference between revisions of "mirc/on events/on sockopen"
(→Examples) |
(→Parameters) |
||
Line 8: | Line 8: | ||
<span style="display: inline-block; width: 105px;">'''<commands>'''</span>The commands to be performed when the event listener's criteria is met. | <span style="display: inline-block; width: 105px;">'''<commands>'''</span>The commands to be performed when the event listener's criteria is met. | ||
+ | |||
+ | == Connection State == | ||
You should be checking {{mIRC|$sockerr}} to know if the connection was sucessful or not, here is a list of the possible value for $sockerr in the on SOCKOPEN event: | You should be checking {{mIRC|$sockerr}} to know if the connection was sucessful or not, here is a list of the possible value for $sockerr in the on SOCKOPEN event: | ||
Line 14: | Line 16: | ||
* '''3''' - Failure establishing socket connection, $sock().wsmsg will contain a more specific error message. | * '''3''' - Failure establishing socket connection, $sock().wsmsg will contain a more specific error message. | ||
* '''4''' - Error resolving given hostname. | * '''4''' - Error resolving given hostname. | ||
− | |||
== Examples == | == Examples == |
Revision as of 19:28, 26 July 2014
The ON SOCKOPEN event triggers when a socket connection initiated with {{mIRC|/sockopen} is either sucessful or failed.
Synopsis
ON <level>:SOCKOPEN:<matchtext>:<commands>
Parameters
<matchtext>The name of the socket you want event to trigger on.
<commands>The commands to be performed when the event listener's criteria is met.
Connection State
You should be checking $sockerr to know if the connection was sucessful or not, here is a list of the possible value for $sockerr in the on SOCKOPEN event:
- 0 - Success.
- 3 - Failure establishing socket connection, $sock().wsmsg will contain a more specific error message.
- 4 - Error resolving given hostname.
Examples
on *:sockopen:name:{ if (!$sockerr) echo -s Connection is sucessful! else { echo -s An error occured while trying to connect: $sock($sockname).wsmsg } }
Compatibility
Added: mIRC v3.5
Added on: 07 Aug 1995
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.