connect_function
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | connect_function [2006/07/25 21:22] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # $EPIC: connect_function.txt, | ||
+ | ======Synopsis: | ||
+ | | ||
+ | |||
+ | ======Technical: | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * If a TCP connection to host < | ||
+ | * If the connection is established, | ||
+ | * The return value of this function is a small integer suitable for use with /[[DCC]] [[dcc RAW|RAW]] and /[[MSG]]. | ||
+ | * The optional [family] argument can be 4, 6, v4, or v6 to specify usage of IPv4 or IPv6. | ||
+ | |||
+ | ======Practical: | ||
+ | This function will let you open up a TCP socket to any host/ | ||
+ | can send messages to the connection using the return value as the key | ||
+ | argument to [[DCC]] [[DCC RAW|RAW]] and [[MSG]]. | ||
+ | connection via /[[ON]] [[on DCC_RAW|DCC_RAW]] "< | ||
+ | |||
+ | ======Returns: | ||
+ | A number to be used for communication with an open TCP connection, | ||
+ | or the empty string if an error occurs. | ||
+ | |||
+ | ======Examples: | ||
+ | A complete example of opening up a connection to the local SMTPd, | ||
+ | sending a command, receiving responses, and cleaning up afterwards. | ||
+ | |||
+ | < | ||
+ | alias mailcheck { | ||
+ | @ :host = [127.0.0.1] | ||
+ | @ :port = 25 | ||
+ | |||
+ | on ^dcc_raw "% $host D *" { | ||
+ | echo ======-- Incoming! --====== $2- | ||
+ | } | ||
+ | on ^dcc_lost "% RAW $host" { | ||
+ | on dcc_raw -"% $2 D" | ||
+ | on dcc_lost -$* | ||
+ | } | ||
+ | |||
+ | @ :fd = connect($host $port) | ||
+ | msg =$fd QUIT | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ======History: | ||
+ | This function first appeared in ircII-2.2pre3 | ||
connect_function.txt · Last modified: 2006/07/25 21:22 by 127.0.0.1