Launcher
To do so, this tutorial implements the EchoLauncher protocol from the
fuchsia.examples library:
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/echo.test.fidl" region_tag="launcher" %}
This is a protocol that lets clients retrieve an instance of the Echo
protocol. Clients can specify a prefix, and the resulting Echo instance
adds that prefix to every response.
There are two methods that can be used to accomplish this:
GetEcho: Takes the prefix as a request, and responds with the client end of a channel connected to an implementation of theEchoprotocol. After receiving the client end in the response, the client can start making requests on theEchoprotocol using the client end.GetEchoPipelined: Takes the server end of a channel as one of the request parameters and binds an implementation ofEchoto it. The client that made the request is assumed to already hold the client end, and will start makingEchorequests on that channel after callingGetEchoPipeliend.
As the name suggests, the latter uses a pattern called protocol request pipelining, and is the preferred approach. This tutorial implements both approaches.
最后更新:
2022 年 12 月 31 日(Saturday) 21:06 CST