Project

General

Profile

Sockopen » History » Revision 7

Revision 6 (Per Amundsen, 11/11/2019 11:02 AM) → Revision 7/16 (Per Amundsen, 11/11/2019 11:05 AM)

_Added in 1.8.10_ 

 */sockopen [-dent46] [bindip] <name> <address/hostname> <address> <port>* 

 Opens a socket connection to the specified ipaddress/hostname and port. 

 *Switches* 

 -d - The specified IP address is the bind ip address. 
 -e - Creates an SSL connection. 
 -n - Disables the "Nagle algorithm":https://en.wikipedia.org/wiki/Nagle%27s_algorithm. 
 -t - TODO 
 -4 - Connect to Ipv4 addresses. 
 -6 - Connect to Ipv6 addresses. 

 *Parameters* 

 [bindip] - Bind ip to be used. 
 <name> - Socket connection name. 
 <address/hostname> <address> - Remote ip address or hostname to connect to. 
 <port> - Remote port to connect to. 

 *Example* 

 <pre> 
 alias example { 
   ; Initiate a connection with "irc.freenode.org" on port 6669, Secured connection. 
   /sockopen -e IRC irc.freenode.org +6697 
 } 
 
 on *:sockopen:IRC:{ 
   ; Send our USER and NICK irc commands. 
   /sockwrite -n IRC USER Tester $+ $rand(1,100) Test Test:mSL Testing $+ $crlf 
   /sockwrite -n IRC NICK Tester $+ $rand(1,100) $crlf 
 } 
 
 ; Show all receiving data in a window. 
 on *:sockread:IRC:{ 
   /window -de @IRC 
   /var %x 
   /sockread %x 
   /aline -p @IRC $iif(%x,$v1,-) 
 } 
 </pre>