(→See Also) |
m (→Compatibility: This was added in 5.3) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{mirc title|On Sockclose - Events}} | ||
The '''ON SOCKCLOSE''' event triggers when a {{mIRC|Sockets#mIRC Sockets|TCP socket}} connection is closed by the remote host. | The '''ON SOCKCLOSE''' event triggers when a {{mIRC|Sockets#mIRC Sockets|TCP socket}} connection is closed by the remote host. | ||
Line 5: | Line 6: | ||
== Parameters == | == Parameters == | ||
− | <span style="display: inline-block; width: 105px;">'''<level>'''</span>The | + | <span style="display: inline-block; width: 105px;">'''<level>'''</span>The corresponding {{mIRC|access levels}} for the event to trigger. |
− | <span style="display: inline-block; width: 105px;">'''<matchtext>'''</span>The name of the target socket. Can be a | + | <span style="display: inline-block; width: 105px;">'''<matchtext>'''</span>The name of the target socket. Can be a {{mirc|wildcard}}. |
<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. | ||
Line 16: | Line 17: | ||
* '''0''' - EOF from the remote host received, this actually means the remote host closed your connection successfuly. | * '''0''' - EOF from the remote host received, this actually means the remote host closed your connection successfuly. | ||
− | * '''3''' - An error occurred while receiving data, or a SSL error occurred, $sock().wsmsg will contain a more specific error message. | + | * '''3''' - An error occurred while receiving data, or a SSL error occurred (most likely SSL cert cypher incompatibility), $sock().wsmsg will contain a more specific error message. |
* '''5''' - An SSL error of some kind occurred when trying to initialize the connection. Unlikely to happen. If you get this you most likely are trying to initiate an SSL socket connection without SSL capabilities (check {mIRC|$sslready}}, which is $false if you don't have them) | * '''5''' - An SSL error of some kind occurred when trying to initialize the connection. Unlikely to happen. If you get this you most likely are trying to initiate an SSL socket connection without SSL capabilities (check {mIRC|$sslready}}, which is $false if you don't have them) | ||
Line 22: | Line 23: | ||
When the socket closes, echo that the socket has closed and some details about it to the active window: | When the socket closes, echo that the socket has closed and some details about it to the active window: | ||
<source lang="mIRC">ON *:SOCKCLOSE:*: { | <source lang="mIRC">ON *:SOCKCLOSE:*: { | ||
− | echo - | + | if (!$sockerr) echo -ag ::=> $sockname Connection to $sock($sockname).ip on port $sock($sockname).port closed by the remote host! |
+ | else echo -ag ::=> An error occured with the socket $sock($sockname).wsmsg | ||
}</source> | }</source> | ||
== Compatibility == | == Compatibility == | ||
− | {{mIRC compatibility| | + | {{mIRC compatibility|5.3}} |
== See Also == | == See Also == |
Latest revision as of 14:52, 13 February 2024
The ON SOCKCLOSE event triggers when a TCP socket connection is closed by the remote host.
Synopsis[edit]
ON <level>:SOCKCLOSE:<name>:<commands>
Parameters[edit]
<level>The corresponding access levels for the event to trigger.
<matchtext>The name of the target socket. Can be a wildcard.
<commands>The commands to be performed when the event listener's criteria is met.
Connection State[edit]
The reason a socket is closed could be because of an error, rather than because the remote host closed your connection on purpose, you should check $sockerr for error, here is a list of the possible value for $sockerr inside the on sockclose event:
- 0 - EOF from the remote host received, this actually means the remote host closed your connection successfuly.
- 3 - An error occurred while receiving data, or a SSL error occurred (most likely SSL cert cypher incompatibility), $sock().wsmsg will contain a more specific error message.
- 5 - An SSL error of some kind occurred when trying to initialize the connection. Unlikely to happen. If you get this you most likely are trying to initiate an SSL socket connection without SSL capabilities (check {mIRC|$sslready}}, which is $false if you don't have them)
Example[edit]
When the socket closes, echo that the socket has closed and some details about it to the active window:
ON *:SOCKCLOSE:*: { if (!$sockerr) echo -ag ::=> $sockname Connection to $sock($sockname).ip on port $sock($sockname).port closed by the remote host! else echo -ag ::=> An error occured with the socket $sock($sockname).wsmsg }
Compatibility[edit]
Added: mIRC v5.3
Added on: 13 Dec 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.
See Also[edit]
- on sockopen
- on sockread
- on sockwrite
- on socklisten
- /sockaccept
- /socklist
- /sockmark
- /sockopen
- /sockpause
- /sockread
- /sockrename
- /sockudp
- /sockwrite
- $sock
A on Action, on Active, on Agent, on Appactive B on Ban C on Char, on Chat, on Chatclose, on Chatopen, on Close, on Connect, on Connectfail, on Ctcpreply D on Dccserver, on Dehelp, on Deop, on Deowner, on Devoice, on Dialog, on Disconnect, on Dns |
J on Join K on Keydown, on Keyup, on Kick M on Midiend, on Mode, on Mp3end |
Q on Queryclose, on Queryopen, on Quit S on Sendfail, on Serv, on Servclose, on Servermode, on Serverop, on Servopen, on Signal, on Snotice, on Sockclose, on Socklisten, on Sockopen, on Sockread, on Sockwrite, on Start U on Udpread, on Udpwrite, on Unban, on Unload, on Unotify, on Usermode |