$sock » History » Version 5
Per Amundsen, 05/24/2018 10:10 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 | 2 | Per Amundsen | |
| 35 | *Example* |
||
| 36 | |||
| 37 | <pre> |
||
| 38 | ; Print number of sockets. |
||
| 39 | //echo -ag $sock(*, 0) |
||
| 40 | |||
| 41 | ; Print the first socket. |
||
| 42 | //echo -ag $sock(*, 1) |
||
| 43 | </pre> |