Project

General

Profile

$sock » History » Version 12

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