Project

General

Profile

$sock » History » Version 7

Per Amundsen, 12/14/2019 10:00 AM

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 2 Per Amundsen
38
*Example*
39
40
<pre>
41
; Print number of sockets.
42
//echo -ag $sock(*, 0)
43
44
; Print the first socket.
45
//echo -ag $sock(*, 1)
46
</pre>