connect

create new socket connection to given server port


Parameters

connect port :integer

Attributes

to :string set socket address
udp use UDP instead of TCP
async return a `:task` resolving to the connected socket

Returns

  • :socket
  • :task

Examples

copy
; connect to local server on port 18966 server: connect 18966

copy
; "connect" to a udp server on port 12345 server: connect.udp 12345

copy
; connect to a remote server on port 18966 server: connect.to:"123.456.789.123" 18966

copy
; parallel connect to many hosts tasks: map hosts 'h -> connect.async.to: h 80 sockets: wait.all tasks

Related