<a id="control-socket"></a>

# Control socket

The `smtpd` process has a control socket as specified by
[`environment.controlsocket.path`](config_startup.html.md#confval-environment.controlsocket.path) or [`environment.controlsocket.port`](config_startup.html.md#confval-environment.controlsocket.port).

All connections begin with a version handshake (two bytes, ASCII char 6 and 12 for version ‘6.12’), follow by one or more request and responses. All requests are sent beginning with a [command](api_reference.html.md) identifier (one byte, ASCII char).
The [command](api_reference.html.md) identifiers are assigned in alphabetical order.
In requests with a Protobuf [request](api_reference.html.md) body, the [command](api_reference.html.md) identifier is followed by
a binary host packed (LE) unsigned 64 bit integer telling the size of the request body.

The response begins with one byte indicating the status; `+` for success, or `E` for error.
It is followed by a binary host (LE) packed unsigned 64 bit integer
telling the size the response data that follows.
In the success case, the data is a Protobuf [response](api_reference.html.md) body.
In the error case, it is an ASCII string.
