Project

General

Profile

$sock » History » Version 2

Per Amundsen, 08/12/2015 06:35 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$sock(name,[N})*
4
5
Returns information about a the Nth socket connection.
6
7
*Parameters*
8
9
name - Name to lookup, can be a wildcard.
10 2 Per Amundsen
[N} - If N = 0, number of matches, otherwise the Nth match. (optiona)
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 2 Per Amundsen
33
*Example*
34
35
<pre>
36
; Print number of sockets.
37
//echo -ag $sock(*, 0)
38
39
; Print the first socket.
40
//echo -ag $sock(*, 1)
41
</pre>