listen
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | listen [2006/08/29 20:18] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # $EPIC: listen.txt, | ||
+ | ======Synopsis: | ||
+ | $__listen__() \\ | ||
+ | $__listen__(< | ||
+ | |||
+ | ======Technical: | ||
+ | * The __listen__ function establishes a passive TCP connection (``server'' | ||
+ | * The < | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * 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. | ||
+ | |||
+ | ======Practical: | ||
+ | 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. | ||
+ | |||
+ | ======Returns: | ||
+ | The port number being listened on, or the empty string on error. | ||
+ | |||
+ | ======Examples: | ||
+ | < | ||
+ | $listen(1025) | ||
+ | $listen(1023) | ||
+ | $listen(0) | ||
+ | $listen() | ||
+ | </ | ||
+ | |||
+ | ======History: | ||
+ | This function first appeared in ircII-2.2pre3 | ||
listen.txt · Last modified: 2006/08/29 20:18 by 127.0.0.1