GSMLG.Socket (GSMLG.Socket v0.1.0)
Link to this section Summary
Functions
Create a socket connecting to somewhere using an URI.
Create a socket connecting to somewhere using an URI, raising if an error
occurs, see connect
.
Create a socket listening somewhere using an URI.
Create a socket listening somewhere using an URI, raising if an error occurs,
see listen
.
Link to this section Types
@type t() :: GSMLG.Socket.Protocol.t()
Link to this section Functions
Link to this function
accept(self)
Link to this function
accept(self, options)
Link to this function
accept!(self)
Link to this function
accept!(self, options)
Link to this function
active(self)
Link to this function
active(self, mode)
Link to this function
active!(self)
Link to this function
active!(self, mode)
Link to this function
close(self)
Link to this function
close!(self)
Link to this function
connect(uri)
Create a socket connecting to somewhere using an URI.
supported-uris
Supported URIs
tcp://host:port
for GSMLG.Socket.TCPssl://host:port
for GSMLG.Socket.SSLws://host:port/path
for GSMLG.Socket.Web (using GSMLG.Socket.TCP)wss://host:port/path
for GSMLG.Socket.Web (using GSMLG.Socket.SSL)udp://host:port
for GSMLG.Socket:UDP
example
Example
{ :ok, client } = GSMLG.Socket.connect "tcp://google.com:80"
client.send "GET / HTTP/1.1\r\n"
client.recv
Link to this function
connect!(uri)
Create a socket connecting to somewhere using an URI, raising if an error
occurs, see connect
.
Link to this function
equal?(self, other)
Link to this function
listen(uri)
Create a socket listening somewhere using an URI.
supported-uris
Supported URIs
If host is *
it will be converted to 0.0.0.0
.
tcp://host:port
for GSMLG.Socket.TCPssl://host:port
for GSMLG.Socket.SSLws://host:port/path
for GSMLG.Socket.Web (using GSMLG.Socket.TCP)wss://host:port/path
for GSMLG.Socket.Web (using GSMLG.Socket.SSL)udp://host:port
for GSMLG.Socket:UDP
example
Example
{ :ok, server } = GSMLG.Socket.listen "tcp://*:1337"
client = server |> GSMLG.Socket.accept!(packet: :line)
client |> GSMLG.Socket.Stream.send(client.recv)
client |> GSMLG.Socket.Stream.close
Link to this function
listen!(uri)
Create a socket listening somewhere using an URI, raising if an error occurs,
see listen
.
Link to this function
local(self)
Link to this function
local!(self)
Link to this function
options(self, opts)
Link to this function
options!(self, opts)
Link to this function
packet(self, type)
Link to this function
packet!(self, type)
Link to this function
passive(self)
Link to this function
passive!(self)
Link to this function
process(self, pid)
Link to this function
process!(self, pid)
Link to this function
remote(self)
Link to this function