Project

General

Profile

Sockopen » History » Version 8

Per Amundsen, 12/14/2019 10:04 AM

1 1 Per Amundsen
_Added in 1.8.10_
2
3 7 Per Amundsen
*/sockopen [-dent46] [bindip] <name> <address/hostname> <port>*
4 1 Per Amundsen
5 7 Per Amundsen
Opens a socket connection to the specified ipaddress/hostname and port.
6
7 1 Per Amundsen
*Switches*
8
9
-d - The specified IP address is the bind ip address.
10
-e - Creates an SSL connection.
11 3 Per Amundsen
-n - Disables the "Nagle algorithm":https://en.wikipedia.org/wiki/Nagle%27s_algorithm.
12 8 Per Amundsen
-t - *TODO*
13 2 Per Amundsen
-4 - Connect to Ipv4 addresses.
14
-6 - Connect to Ipv6 addresses.
15 1 Per Amundsen
16
*Parameters*
17
18
[bindip] - Bind ip to be used.
19
<name> - Socket connection name.
20 7 Per Amundsen
<address/hostname> - Remote ip address or hostname to connect to.
21 1 Per Amundsen
<port> - Remote port to connect to.
22
23
*Example*
24
25
<pre>
26
alias example {
27 6 Per Amundsen
  ; Initiate a connection with "irc.freenode.org" on port 6669, Secured connection.
28 1 Per Amundsen
  /sockopen -e IRC irc.freenode.org +6697
29
}
30
 
31
on *:sockopen:IRC:{
32 6 Per Amundsen
  ; Send our USER and NICK irc commands.
33 1 Per Amundsen
  /sockwrite -n IRC USER Tester $+ $rand(1,100) Test Test:mSL Testing $+ $crlf
34
  /sockwrite -n IRC NICK Tester $+ $rand(1,100) $crlf
35
}
36
 
37 6 Per Amundsen
; Show all receiving data in a window.
38 1 Per Amundsen
on *:sockread:IRC:{
39
  /window -de @IRC
40
  /var %x
41
  /sockread %x
42
  /aline -p @IRC $iif(%x,$v1,-)
43
}
44
</pre>