On this page
Port
Functions related to Erlang ports.
Summary
Types
Functions
- call(port, operation, data)
-
Makes a synchronous call to the
portand returns its reply as a term - close(port)
-
Closes the
port - command(port, data, options \\ [])
-
Sends
datato the port driverport - connect(port, pid)
-
Associates the
portidentifier with apid - control(port, operation, data)
-
Sends a synchronous control command to the
portand returns its reply as a binary - info(port)
-
Returns information about the
portornilif the port is closed - info(port, spec)
-
Returns information about the
portornilif the port is closed - list()
-
Returns a list of the ports for the current node
- open(name, settings)
-
Opens an Erlang port given a tuple
nameand a list ofsettings
Types
name()
name ::
{:spawn, charlist | binary} |
{:spawn_driver, charlist | binary} |
{:spawn_executable, charlist | atom} |
{:fd, non_neg_integer, non_neg_integer}
Functions
call(port, operation, data)
call(port, integer, term) :: term
Makes a synchronous call to the port and returns its reply as a term.
Not all port drivers support this control feature.
For more information, see :erlang.port_call/3.
Inlined by the compiler.
close(port)
close(port) :: true
Closes the port.
For more information, see :erlang.port_close/1.
Inlined by the compiler.
command(port, data, options \\ [])
command(port, iodata, [:force | :nosuspend]) :: boolean
Sends data to the port driver port.
For more information, see :erlang.port_command/2.
Inlined by the compiler.
connect(port, pid)
connect(port, pid) :: true
Associates the port identifier with a pid.
For more information, see :erlang.port_connect/2.
Inlined by the compiler.
control(port, operation, data)
control(port, integer, iodata) :: iodata | binary
Sends a synchronous control command to the port and returns its reply as a binary.
Not all port drivers support this feature.
For more information, see :erlang.port_control/3.
Inlined by the compiler.
info(port)
Returns information about the port or nil if the port is closed.
For more information, see :erlang.port_info/1.
info(port, spec)
info(port, atom) :: {atom, term} | nil
Returns information about the port or nil if the port is closed.
For more information, see :erlang.port_info/2.
list()
list() :: [port]
Returns a list of the ports for the current node.
For more information, see :erlang.ports/0.
Inlined by the compiler.
open(name, settings)
open(name, list) :: port
Opens an Erlang port given a tuple name and a list of settings.
Name
The supported values for name are:
{:spawn, command}- to run an external program. The first space separated word ofcommandwill be considered as the name of the program to run, so use{:spawn_executable, command}to run a program having spaces in its name.{:spawn_driver, command}- similar to{:spawn, command}, but to run a loaded driver.{:spawn_executable, filename}- similar to{:spawn, filename}, but to run an external executable. With this option,filenamein its whole is considered the name of the program to execute.{:fd, fd_in, fd_out}- to access file descriptors used by Erlang,fd_inbeing used for standard input,fd_outfor standard output.
For more information, see :erlang.open_port/2.
Inlined by the compiler.
© 2012 Plataformatec
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/elixir/1.3.4/Port.html