Project

General

Profile

$sock » History » Revision 6

Revision 5 (Per Amundsen, 05/24/2018 10:10 AM) → Revision 6/12 (Per Amundsen, 06/25/2018 03:01 PM)

_Added in 1.9.0_ 

 *$sock(name,[N])* 

 Returns information about a the Nth socket connection. 

 *Parameters* 

 name - Name to lookup, can be a [[Scripting_Wildcards|wildcard]]. 
 [N} - If N = 0, number of matches, otherwise the Nth match. (optionally) 

 *Properties* 

 .name - Name of the socket. 
 .addr - Hostname the socket is connected to. 
 .sent - Number of bytes sent. 
 .rcvd - Number of bytes received. 
 .sq - Number of bytes in send queue. 
 .rq - Number of bytes in receive queue. 
 .status - Status of the connection: paused/active. 
 .ip - IP Addresss the socket is connected to. 
 .port - Port the socket is connected to. 
 .ls - Number of seconds since the socket last sent data. 
 .lr - Number of seconds since the socket last received data. 
 .mark - Socket mark set by [[/sockmark]]. 
 .type - Socket type udp/tcp. 
 .to - Number of sockets since it was opened. 
 .wsmsg - Return the last socket error message. 
 .wserr - Return the last socket error. 
 .pause - Returns [[$true]] if socket is paused, otherwise [[$false]]. 
 .ssl - Returns [[$true]] if socket is a SSL connection, otherwise [[$false]]. 
 .sport - Returns the source port from the last received UDP packet. 
 .saddr - Returns the source address from the last received UDP packet. 
 .bindip - Returns the local ip address the socket is bound to. 
 .bindport - Returns the local port the socket is bound to. 
 .starttls - TODO 

 *Example* 

 <pre> 
 ; Print number of sockets. 
 //echo -ag $sock(*, 0) 

 ; Print the first socket. 
 //echo -ag $sock(*, 1) 
 </pre>