From WikiChip
Difference between revisions of "mirc/identifiers/$sockerr"
< mirc‎ | identifiers

(Synopsis)
 
Line 1: Line 1:
{{mirc title|$cnick Identifier}}'''$cnick''' returns the 'Nick or address' field from the Edit dialog of the Nth entry in the Nick Colors dialog, or if a nick/address is specified, returns the Nth position of the item in list that matches the nick. If the nick/address does not match any items, returns zero.
+
{{mirc title|$sockerr identifier}}'''$sockerr''' returns the sock error number if an error occurred.
  
 +
$sockerr is not a local identifier only set inside event, it is set after any /sock* command as well, meaning that $sockerr can change in value inside the same on sockread event.
 +
 +
== Synopsis ==
 +
<pre>$sockerr</pre>
  
 
== Parameters ==
 
== Parameters ==
 +
None
 +
 +
== Properties ==
 +
None
  
* '''<N/nick>''' - a number representing the Nth item in the Nick Color dialog or a nickname/address used as a match against the field 'Nick or address' in Nick Color Edit dialog
+
== Error codes ==
* '''M''' - if you use the .color property and no item is found via a nick/address match, the 'Normal Text' color is returned, if M is 1, the 'Listbox text' is color is returned
 
  
== Properties ==
+
Remember that using a /sock* command will change the $sockerr value, so these error codes must be checked prior any /sock* command
* '''.color/.colour''' - return the color for that entry. if no item is found via a nick/address match, the 'Normal Text' color is returned, if the M parameter is 1, the 'Listbox text' is color is returned
+
 
* '''.modes''' - return the 'Channel modes' field
+
=== on SOCKOPEN ===
* '''.levels''' - return the 'User levels' field
+
* 0: success
* '''.method''' - return the 'Method' field
+
* 3: failure establishing socket connection (W)
* '''.anymode''' - return the state of the 'Any mode' checkbox
+
* 4: error resolving given hostname
* '''.nomode''' - return the state of the 'No mode' checkbox
+
 
* '''.ignore''' - return the state of the 'Ignore' checkbox
+
=== on SOCKLISTEN ===
* '''.op''' - return the state of the 'Op' checkbox
+
* 0: new socket successfully accepted
* '''.voice''' - return the state of the 'Voice' checkbox
+
* 1: error occurred on listening socket (W)
* '''.protect''' - return the state of the 'Protect' checkbox
+
* 2: error accepting new socket (W)
* '''.notify''' - return the state of the 'notify' checkbox
+
* 4: not enough memory for new socket
* '''.idle''' - return the 'Idle time' field
+
 
* '''.auto''' - return the state of the 'Auto color' option (where you can use '*' as a color to enable the option)
+
=== on SOCKREAD ===
 +
* 0: data received
 +
* 3: error on connected socket occurred (W)
 +
 
 +
=== on SOCKWRITE ===
 +
* 0: all data successfully written
 +
* 3: error trying to send data (W)
 +
 
 +
=== on SOCKCLOSE ===
 +
* 0: EOF from other end received
 +
* 3: an error occurred while receiving data, or a SSL error occurred (W)
 +
* 5: a certain(?) SSL error occurred during sockopen
 +
 
 +
'''Note 1:''' (W) = For these errors, $sock().wserr contains a specific WinSock error number and $sock().wsmsg the Winsock error text
 +
 
 +
'''Note 2:''' These codes were taken from http://www.xise.nl/mirc/wiki/doku.php/doku.php?id=sockerr
  
 
== Example ==
 
== Example ==
<source lang="mIRC">//echo -a $cnick(1).color</source>
+
<source lang="mIRC">on *:sockread:name:{
 +
  if ($sockerr) return
 +
  …
 +
}</source>
  
 
== Compatibility ==
 
== Compatibility ==
{{mIRC compatibility|5.9}}
+
{{mIRC compatibility|5.3}}
  
 
== See Also ==
 
== See Also ==
{{mIRC|/cnick}}
+
* {{mIRC|$sock}}
 
+
* {{mIRC|$sockname}}
 
+
* {{mIRC|$sockbr}}
[[Category:mIRC identifiers|cnick]]
+
{{mIRC identifier list}}
 +
[[Category:mIRC identifiers|sockerr]]

Latest revision as of 02:49, 25 April 2023

$sockerr returns the sock error number if an error occurred.

$sockerr is not a local identifier only set inside event, it is set after any /sock* command as well, meaning that $sockerr can change in value inside the same on sockread event.

Synopsis[edit]

$sockerr

Parameters[edit]

None

Properties[edit]

None

Error codes[edit]

Remember that using a /sock* command will change the $sockerr value, so these error codes must be checked prior any /sock* command

on SOCKOPEN[edit]

  • 0: success
  • 3: failure establishing socket connection (W)
  • 4: error resolving given hostname

on SOCKLISTEN[edit]

  • 0: new socket successfully accepted
  • 1: error occurred on listening socket (W)
  • 2: error accepting new socket (W)
  • 4: not enough memory for new socket

on SOCKREAD[edit]

  • 0: data received
  • 3: error on connected socket occurred (W)

on SOCKWRITE[edit]

  • 0: all data successfully written
  • 3: error trying to send data (W)

on SOCKCLOSE[edit]

  • 0: EOF from other end received
  • 3: an error occurred while receiving data, or a SSL error occurred (W)
  • 5: a certain(?) SSL error occurred during sockopen

Note 1: (W) = For these errors, $sock().wserr contains a specific WinSock error number and $sock().wsmsg the Winsock error text

Note 2: These codes were taken from http://www.xise.nl/mirc/wiki/doku.php/doku.php?id=sockerr

Example[edit]

on *:sockread:name:{
  if ($sockerr) return

}

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]

[Expand]
v · d · e mIRC identifier list