Project

General

Profile

Sockopen » History » Version 14

Per Amundsen, 12/23/2021 05:49 AM

1 1 Per Amundsen
_Added in 1.8.10_
2
3 14 Per Amundsen
*/sockopen [-dentI46Cu] [bindip] <name> <address/hostname> <port> [certificate]*
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 1 Per Amundsen
-t - *TODO*
13 9 Per Amundsen
-I - Accept invalid remote SSL/TLS certificates. *(AdiIRC only)*
14 2 Per Amundsen
-4 - Connect to Ipv4 addresses.
15 1 Per Amundsen
-6 - Connect to Ipv6 addresses.
16
-C - Indicates that [certificate] is specified. *(AdiIRC only)*
17 14 Per Amundsen
-u - Enables "dual stack sockets":https://docs.microsoft.com/en-us/windows/win32/winsock/dual-stack-sockets.
18 1 Per Amundsen
19
*Parameters*
20
21
[bindip] - Bind ip to be used.
22
<name> - Socket connection name.
23 7 Per Amundsen
<address/hostname> - Remote ip address or hostname to connect to.
24 1 Per Amundsen
<port> - Remote port to connect to.
25 10 Per Amundsen
[certificate] - the SSL certificate "pfx":https://en.wikipedia.org/wiki/PKCS_12 file to use with -C, if not specified, the global client certificate is used. *(AdiIRC only)*
26 1 Per Amundsen
27
*Example*
28
29
<pre>
30
alias example {
31 13 Per Amundsen
  ; Initiate a connection with "irc.libera.chat" on port 6669, Secured connection.
32
  /sockopen -e IRC irc.libera.chat +6697
33 1 Per Amundsen
}
34
 
35
on *:sockopen:IRC:{
36 6 Per Amundsen
  ; Send our USER and NICK irc commands.
37 1 Per Amundsen
  /sockwrite -n IRC USER Tester $+ $rand(1,100) Test Test:mSL Testing $+ $crlf
38
  /sockwrite -n IRC NICK Tester $+ $rand(1,100) $crlf
39
}
40
 
41 6 Per Amundsen
; Show all receiving data in a window.
42 1 Per Amundsen
on *:sockread:IRC:{
43
  /window -de @IRC
44
  /var %x
45
  /sockread %x
46
  /aline -p @IRC $iif(%x,$v1,-)
47
}
48
</pre>