View Source Membrane.TCP.Source (Membrane TCP plugin v0.6.0)
Element that reads packets from a TCP socket and sends their payloads through the output pad.
Element options
Passed via struct Membrane.TCP.Source.t/0
connection_side
:server | :client | {:client, server_address :: :inet.ip_address(), server_port_no :: :inet.port_number()}
Required
Determines whether this element will operate like a server or a client when establishing TCP connection. In case of client-side connection server address and port number are required, unlesslocal_socket
is provided.local_address
:inet.socket_address()
Default value:
:any
An IP Address from which the socket will connect or will listen on. It allows to choose which network interface to use if there's more than one.local_port_no
:inet.port_number()
Default value:
0
A TCP port number used when connecting to a listening socket or starting a listening socket. If not specified any free port is chosen.local_socket
:gen_tcp.socket() | nil
Default value:
nil
Already connected TCP socket, if provided it will be used instead of creating and connecting a new one. It's REQUIRED to pass control of it to this element from the previous owner. It can be done by receiving a{:request_socket_control, socket, pid}
message sent by this element to it's parent and calling:gen_tcp.controlling_process(socket, pid)
(needs to be called by a process currently controlling the socket)recv_buffer_size
pos_integer()
Default value:
1048576
Size of the receive buffer. Packages of size greater than this buffer will be truncatedon_connection_closed
:raise_error | :send_eos
Default value:
:send_eos
Defines the element's behavior if the TCP connection is closed by the peer::raise_error
- raise an error.:send_eos
- send an:end_of_stream
on the output pad.
Pads
:output
Accepted formats:
%RemoteStream{type: :bytestream}
Direction: | :output |
Availability: | :always |
Flow control: | :manual |
Demand unit: | :buffers |
Summary
Types
Notification sent when a local socket handle was provided via local_socket
option.
Struct containing options for Membrane.TCP.Source
Types
@type request_socket_control() :: {:request_socket_control, :gen_tcp.socket(), pid()}
Notification sent when a local socket handle was provided via local_socket
option.
@type t() :: %Membrane.TCP.Source{ connection_side: :server | :client | {:client, server_address :: :inet.ip_address(), server_port_no :: :inet.port_number()}, local_address: :inet.socket_address(), local_port_no: :inet.port_number(), local_socket: :gen_tcp.socket() | nil, on_connection_closed: :raise_error | :send_eos, recv_buffer_size: pos_integer() }
Struct containing options for Membrane.TCP.Source
Functions
@spec options() :: keyword()
Returns description of options available for this module