Skip to content

Commit 998b2e0

Browse files
authored
docs(cli): document the .sock listener rule (#1647)
## Summary The `--host`/`--port` help text in both binaries and two passages in `docs/python-client.md` still taught the deprecated `--port 0` Unix-socket spelling. Per `src/server/transport.rs` the rule is: a `--host` ending in `.sock` selects a Unix domain socket whatever `--port` says (the b10621 rule), `--port 0` on TCP binds an ephemeral port, and the legacy `--port 0` + path spelling emits a deprecation warning. The four flag doc-comments and both doc examples now describe the `.sock` rule. ## Related issues Closes #1631 ## Type of change - [ ] `feat` — new user-visible feature - [ ] `fix` — bug fix - [ ] `perf` — performance improvement (include before/after numbers in the PR body) - [ ] `refactor` — internal restructuring without behavior change - [ ] `chore` — build, CI, dependencies, release infrastructure - [x] `docs` — documentation only - [ ] `test` — tests only
1 parent 6741215 commit 998b2e0

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

docs/python-client.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ Start a matching server with the CLI:
7070
# TCP
7171
mlxcel serve -m mlx-community/Qwen3-4B-4bit --host 127.0.0.1 --port 8080
7272

73-
# Unix domain socket: --port 0 reinterprets --host as the socket path
74-
mlxcel serve -m mlx-community/Qwen3-4B-4bit --host /tmp/mlxcel.sock --port 0
73+
# Unix domain socket: a --host ending in .sock selects socket mode
74+
mlxcel serve -m mlx-community/Qwen3-4B-4bit --host /tmp/mlxcel.sock
7575
```
7676

7777
Passing both a model and a connect target raises `MlxcelError`, because the mode would be ambiguous.
@@ -90,7 +90,7 @@ with mlxcel.LLM("mlx-community/Qwen3-4B-4bit", socket=str(runtime_dir / "mlxcel.
9090
print(llm.generate("hello"))
9191
```
9292

93-
The CLI equivalent is `mlxcel serve --host "$XDG_RUNTIME_DIR/mlxcel.sock" --port 0`.
93+
The CLI equivalent is `mlxcel serve --host "$XDG_RUNTIME_DIR/mlxcel.sock"`.
9494

9595
On macOS, `$TMPDIR` already expands to a per-user path under `/var/folders`, so the default socket is private there. On Linux without an active login session, `$XDG_RUNTIME_DIR` may be absent; fall back to a `0700` subdirectory under your home directory if needed.
9696

src/bin/mlx_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ struct ServerArgs {
400400
#[arg(long = "lora-fuse")]
401401
lora_fuse: bool,
402402

403-
/// Host address to bind to (or Unix socket path when --port 0)
403+
/// Host address to bind to (a value ending in .sock is served as a Unix domain socket)
404404
#[arg(long, env = "LLAMA_ARG_HOST", default_value = "127.0.0.1")]
405405
host: String,
406406

407-
/// Port number to listen on (0 = Unix socket mode using --host as socket path)
407+
/// Port number to listen on (0 = bind an ephemeral port; ignored when --host ends in .sock)
408408
#[arg(long, env = "LLAMA_ARG_PORT", default_value_t = 8080)]
409409
port: u16,
410410

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,11 +1186,11 @@ pub(crate) struct ServeArgs {
11861186
#[arg(short = 'a', long, env = "LLAMA_ARG_ALIAS", value_name = "NAME")]
11871187
alias: Option<String>,
11881188

1189-
/// Host address to bind to (or Unix socket path when --port 0)
1189+
/// Host address to bind to (a value ending in .sock is served as a Unix domain socket)
11901190
#[arg(long, env = "LLAMA_ARG_HOST", default_value = "127.0.0.1")]
11911191
host: String,
11921192

1193-
/// Port number to listen on (0 = Unix socket mode using --host as socket path)
1193+
/// Port number to listen on (0 = bind an ephemeral port; ignored when --host ends in .sock)
11941194
#[arg(long, env = "LLAMA_ARG_PORT", default_value_t = 8080)]
11951195
port: u16,
11961196

0 commit comments

Comments
 (0)