# Legacy flcpy integrations

> Documentation version: 3.0
> HTML: https://docs.flarelive.manifolddynamics.com/manual/operation/messaging.html
> [Complete contents](https://docs.flarelive.manifolddynamics.com/contents.md) · [Agent index](https://docs.flarelive.manifolddynamics.com/llms.txt)

**flcpy is not recommended for new workflows.** Use it when continuing an older project or an existing simulation-I/O integration. For new scene construction, project management and control loops, use [Workspace RPC](https://docs.flarelive.manifolddynamics.com/manual/operation/rpc.md).

flcpy connects to the optional **Message control** TCP listener. It has its own object IDs and protocol. A GUI or headless instance can host the listener; the program's running mode and its control interface are separate choices.

## Enable the listener

In the GUI, enable **Simulation > Message control**. Its enabled state, port and remote-listening preference are stored globally and survive world switches.

For a headless instance:

```sh
flare-live-cli serve --project case.fll --simulation-io
```

This listens on `127.0.0.1:25556`. Enabling the listener leaves simulation uninitialized; the controller initializes it when ready. Headless hosts start with Message control disabled unless requested.

## Connect an existing controller

Use **flcpy 0.3.x or newer** with Flare Live 3.0. After enabling the listener, connect using its defaults:

```python
import flcpy

sim = flcpy.connect()
```

The current client defaults to `recover_world=False`. For older 0.2.x or arcpy-based scripts, upgrade flcpy and replace recovery calls with Begin/End Experiment as described in [migration](https://docs.flarelive.manifolddynamics.com/manual/migration/from-2x.md).

Use `sim.start()` to initialize and the controller's simulate/exchange loop to apply inputs, advance and read outputs. `sim.stop()` clears Simulation. Wrap temporary cloning or parameter changes in `sim.begin_experiment()` / `sim.end_experiment()`; call Stop before End experiment. Close the TCP connection with `sim.close()` when finished.

These operations follow the same [Document, Experiment and Simulation lifecycle](https://docs.flarelive.manifolddynamics.com/manual/concepts/lifecycle.md). Persistent Document edits still require saving an FLL separately. Query object IDs for the current Messaging scene; RPC object handles belong to the Workspace API.

## Port and remote connections

The default scope is local-only. In **Simulation settings**, **Allow remote requests** changes the listener to `0.0.0.0`. For CLI `serve`, use `--io-allow-remote` together with `--simulation-io`; `--io-port` selects another port. The RPC equivalent is `ws.configure_simulation_io(True)`, with optional `port` and `allow_remote` arguments.

Allow remote requests only on a trusted network: Messaging has no authentication or encryption. A remote client connects to the host's actual IP address. Changing an active listener's port or scope disconnects its clients. Workspace RPC remains local to the OS user.

Errors that the legacy protocol cannot return appear in the application's Log. Use the protocol documentation shipped with your installation for the exact binary message layout.
