From WikiChip
Editing mirc/on events/on sockopen
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | The '''ON SOCKOPEN''' event triggers when a socket connection initiated with {{mIRC|/sockopen} is either sucessful or failed. | |
− | The '''ON SOCKOPEN''' event triggers when a | ||
== Synopsis == | == Synopsis == | ||
Line 6: | Line 5: | ||
== Parameters == | == Parameters == | ||
− | + | <span style="display: inline-block; width: 105px;">'''<matchtext>'''</span>The name of the socket you want event to trigger on. | |
− | |||
− | <span style="display: inline-block; width: 105px;">'''<matchtext>'''</span>The name of the socket you want | ||
<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. | ||
− | + | 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: | |
− | |||
− | |||
* '''0''' - Success. | * '''0''' - Success. | ||
− | * '''3''' - Failure establishing socket connection | + | * '''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 == | ||
<source lang="mirc"> | <source lang="mirc"> | ||
− | on *: | + | on *:socklisten:name:{ |
− | + | if (!$sockerr) sockaccept myprefix $+ $ticks | |
− | |||
− | if ($sockerr) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
else { | else { | ||
− | + | echo -s An error occured while trying to accept a connection: $sock($sockname).wsmsg | |
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
Line 51: | Line 31: | ||
== See Also == | == See Also == | ||
− | * {{ | + | * {{mIRC|List of on events|mIRC events}} |
− | |||
− | |||
− | |||
− | |||
* {{mIRC|/sockwrite}} | * {{mIRC|/sockwrite}} | ||
+ | * {{mIRC|/sockclose}} | ||
* {{mIRC|/sockread}} | * {{mIRC|/sockread}} | ||
− | |||
* {{mIRC|/sockaccept}} | * {{mIRC|/sockaccept}} | ||
* {{mIRC|/sockpause}} | * {{mIRC|/sockpause}} | ||
− | |||
* {{mIRC|$sock}} | * {{mIRC|$sock}} | ||
* {{mIRC|$sockbr}} | * {{mIRC|$sockbr}} | ||
* {{mIRC|$sockerr}} | * {{mIRC|$sockerr}} | ||
− | [[Category: | + | [[Category:MIRC on events]] |