# $EPIC: connect_function.txt,v 1.2 2006/07/24 07:11:25 sthalik Exp $
$connect(<host> <port> [family])
This function will let you open up a TCP socket to any host/port. You can send messages to the connection using the return value as the key argument to DCC RAW and MSG. You will receive messages from the connection via /ON DCC_RAW ”<fd> <host> D <data>”.
A number to be used for communication with an open TCP connection, or the empty string if an error occurs.
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 }
This function first appeared in ircII-2.2pre3