# `Modbuv.Tcp.Server`
[🔗](https://github.com/ultra0224/modbuv/blob/v0.1.0/lib/modbuv/tcp/server.ex#L1)

Modbus TCP server: listens on a port, serves each connection from the shared
DB, and optionally notifies the owner of parsed requests.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `get_db`

```elixir
@spec get_db(pid()) :: map()
```

Returns the raw DB map currently held by the server's shared model.

# `start_link`

```elixir
@spec start_link(keyword(), keyword()) :: {:ok, pid()} | {:error, term()}
```

Starts the TCP server GenServer. `params` must include `:model` and may include `:port`, `:timeout`, `:active`, `:fc_map`, and `:sup_opts`.

# `stop`

```elixir
@spec stop(pid()) :: :ok
```

Stops the TCP server GenServer process.

# `update`

```elixir
@spec update(pid(), tuple()) :: term()
```

Reads or writes the server's local DB using a frame tuple. Validates the frame against the fc_map and returns the result or `{:error, :efun}` for unknown function codes.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
