Project

General

Profile

$sock » History » Version 11

Per Amundsen, 01/09/2023 11:46 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3 3 Per Amundsen
*$sock(name,[N])*
4 1 Per Amundsen
5
Returns information about a the Nth socket connection.
6
7
*Parameters*
8
9 5 Per Amundsen
name - Name to lookup, can be a [[Scripting_Wildcards|wildcard]].
10 3 Per Amundsen
[N} - If N = 0, number of matches, otherwise the Nth match. (optionally)
11 1 Per Amundsen
12
*Properties*
13
14
.name - Name of the socket.
15
.addr - Hostname the socket is connected to.
16
.sent - Number of bytes sent.
17
.rcvd - Number of bytes received.
18
.sq - Number of bytes in send queue.
19
.rq - Number of bytes in receive queue.
20
.status - Status of the connection: paused/active.
21
.ip - IP Addresss the socket is connected to.
22
.port - Port the socket is connected to.
23
.ls - Number of seconds since the socket last sent data.
24
.lr - Number of seconds since the socket last received data.
25
.mark - Socket mark set by [[/sockmark]].
26
.type - Socket type udp/tcp.
27
.to - Number of sockets since it was opened.
28
.wsmsg - Return the last socket error message.
29
.wserr - Return the last socket error.
30
.pause - Returns [[$true]] if socket is paused, otherwise [[$false]].
31
.ssl - Returns [[$true]] if socket is a SSL connection, otherwise [[$false]].
32 4 Per Amundsen
.sport - Returns the source port from the last received UDP packet.
33
.saddr - Returns the source address from the last received UDP packet.
34 6 Per Amundsen
.bindip - Returns the local ip address the socket is bound to.
35
.bindport - Returns the local port the socket is bound to.
36 7 Per Amundsen
.starttls - *TODO*
37 10 Per Amundsen
.certfile - Returns the server certificate file if the socket is a listening socket, otherwise the client certificate file. *(AdiIRC only)*
38 11 Per Amundsen
.upnp - Returns [[$true]] if using "UPNP":https://en.wikipedia.org/wiki/Universal_Plug_and_Play otherwise [[$false]].
39 9 Per Amundsen
40 2 Per Amundsen
*Example*
41
42
<pre>
43
; Print number of sockets.
44
//echo -ag $sock(*, 0)
45
46
; Print the first socket.
47
//echo -ag $sock(*, 1)
48
</pre>