Basics
4 min read
4 min read
4 min read
4 min read
4 min read
4 min read
4 min read
4 min read
4 min read
In the Greeter example, a client calls an operation of an Ice object hosted by a server, often on another computer, and the call looks like an ordinary method call. This is a remote procedure call (RPC): an application calls an operation that another application implements, and Ice takes care of the communication.
How a Call Works
When a client calls an operation:
- The client calls a method on a proxy, a local object that represents the remote Ice object.
- Ice sends a request, with the operation's arguments, to the server that hosts the Ice object.
- In the server, Ice dispatches the request to the servant, the object in your server code that implements the Ice object.
- Ice sends the result, or the exception the servant throws, back to the client, where the proxy method returns this result or throws this exception.
Ice sends requests and replies as messages of the Ice protocol, over a transport such as TCP, SSL, or WebSocket. The Ice runtime creates and reads these messages: your application never handles them.
The client and the server agree on the operations and the types of their parameters through Slice definitions. Slice does not depend on a programming language, so a client and a server written in different languages can communicate.
Client and Server Structure
Ice client and server structure.
An Ice client or server combines the code you write, code generated from your Slice definitions, and the Ice libraries:
- The application code is the code you write: a client calls operations through proxies, and a server implements them in servants.
- The generated code holds the proxies that a client calls and the skeletons that servants implement. Together with the Ice runtime, it marshals and unmarshals the arguments and results: it converts them to and from the byte sequences Ice sends over the network.
- The Ice runtime sends and receives requests and replies, and manages the network connections. Your application uses it through the Ice API.
- An object adapter, part of the Ice API, receives the requests for the servants registered with it, and dispatches each request to its servant.
Client and server are roles, not kinds of programs: the client sends a request, and the server processes it. An application can take both roles, for example a client that receives callbacks from the server it calls. See Terminology.
This language mapping supports clients only: the servers your client calls are written with another mapping, such as C++, C#, Java, Python, or Swift.
The rest of this chapter introduces Slice and the Slice compilers and Ice terminology.