$sock

From Scriptwiki
Revision as of 13:27, 3 February 2011 by Vliedel (talk | contribs) (wow this page is still very ugly)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

$sock(name,N)
This returns information about a socket connection that you created using the socket commands.

Properties:
.name is the name you give to a connection to identify it
.addr original named address if one was used.
.sent and .rcvd return the number of bytes sent and rcvd over that connection so far
.sq and .rq return the number of bytes queued in the send and receive buffers respectively
.ls and .lr return the number of seconds since the connection last sent and last received info
.mark is a user storage area max. 512 bytes (see /sockmark)
.type returns the socket type, TCP or UDP
.saddr and .sport return the source address and port of the last received UDP packet
.to returns the number of seconds the socket has been open
.wserr returns the last winsock error number that occurred on a socket
.wsmsg returns the last winsock error message match the error number
.ssl returns $true for an SSL connection
.pause returns $true if a socket has been paused

Note: You can use a wildcard name to quickly reference matching entries. The N parameter is optional, if it isn't specified it is assumed to be 1.