on socklisten
Indice
The ON SOCKLISTEN event triggers when a connection is made on a listening TCP socket created with /socklisten
| Contents - 1 Synopsis - 2 Parameters - 3 Accepting a connection - 4 Examples - 5 Compatibility - 6 See Also |
Synopsis
ON <level>:SOCKLISTEN:<matchtext>:<commands>
Parameters
**
**
Accepting a connection
Note: By design, you cannot prevent a socket from being accepted, as in, Windows accepts the connection even before mIRC.
You can use /sockaccept
Note: If a new connection occurs on a listening socket but there is no on socklisten event matching that socket, the connection is rejected.
You should be checking for $sockerr before accepting the connection to see if an error occured, here is a list of the possible value for $sockerr in the on SOCKLISTEN event:
- 0 - New socket successfuly accepted.
- 1 - Error occurred on listening socket, $sock().wsmsg will contain a more specific error message. Note that getting this error is considered rare.
- 2 - Error accepting new socket, $sock().wsmsg will contain a more specific error message.
- 4 - Not enough memory for new socket. Note that getting this error is considered rare.
Examples
on *:socklisten:name:{
if (!$sockerr) sockaccept myprefix $+ $ticks
else {
echo -s An error occured while trying to accept a connection: $sock($sockname).wsmsg
}
}
Compatibility
Added: mIRC v3.5
Added on: 08/07/1995
Note: Individual switches were not taken into consideration.