Cure.Server
The server is responsible for the communication between Elixir and C. The communication is based on Erlang Ports.
Summary↑
send_data(server, msg) | Sends binary data to the C-program that the server is connected with. A callback-function (arity 1) can be added to handle the incoming response of the C-program. If no callback is provided, the result is sent back to the process that called this function. If the third argument is :sync, this function blocks and returns the result |
send_data(server, msg, callback) | |
start(program_name) | Starts a Cure.Server process and opens a Port that can communicate with a C-program |
start_link(program_name) | Starts a Cure.Server process, links it to the calling process and opens a Port that can communicate with a C-program |
stop(server) | Stops the server process |
Functions
Specs:
- send_data(pid, binary) :: :ok
Sends binary data to the C-program that the server is connected with. A callback-function (arity 1) can be added to handle the incoming response of the C-program. If no callback is provided, the result is sent back to the process that called this function. If the third argument is :sync, this function blocks and returns the result.
Specs:
- send_data(pid, binary, (binary -> any) | nil | :sync) :: :ok | binary
Specs:
- start(String.t) :: GenServer.on_start
- start(String.t) :: GenServer.on_start
Starts a Cure.Server process and opens a Port that can communicate with a C-program.
Starts a Cure.Server process, links it to the calling process and opens a Port that can communicate with a C-program.
Specs:
- stop(pid) :: :ok
Stops the server process.