User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

listen [2006/08/29 20:18] (current)
Line 1: Line 1:
 +# $EPIC: listen.txt,​v 1.3 2006/08/29 18:22:56 sthalik Exp $
 +$__listen__() \\
 +$__listen__(<​port>​ [family])
 +   * The __listen__ function establishes a passive TCP connection (``server''​).
 +   * The <​port>​ argument is optional and if provided is taken as a number.
 +   * If the <​port>​ argument is not a number, the empty string is returned.
 +   * If the <​port>​ argument is not zero and less than 1024, the empty string is returned.
 +   * The optional family argument can be 4, 6, v4, or v6, and tells the client whether it should bind to IPv4 or IPv6.
 +   * If the requested port is not available (probably because it is in use by someone else), an error is output and the empty string is returned.
 +   * The return value is the local port number associated with the connection.
 +If you want your script to act as an Internet server, the $listen()
 +function lets you establish a place where others can $[[connect
 +function|connect]]() to you.  Once they $[[connect function|connect]]()
 +to you, you are given a small integer that acts in the same way that
 +$[[connect function|connect]]() return values do.
 +The port number being listened on, or the empty string on error.
 +$listen(1025) ​            ​returns 1025
 +$listen(1023) ​            ​error,​ returns nothing
 +$listen(0) ​               returns a system-allocated port number
 +$listen() ​                ​returns a system-allocated port number
 +This function first appeared in ircII-2.2pre3
listen.txt ยท Last modified: 2006/08/29 20:18 (external edit)