---
title: "Greeter Example"
url: https://docs.zeroc.com/ice/3.8/greeter-example
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Greeter Example

Parts of this page are for some programming languages only, and name them. For one language's text alone, see [C++](https://docs.zeroc.com/ice/3.8/greeter-example/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/greeter-example/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/greeter-example/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/greeter-example/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/greeter-example/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/greeter-example/php.md), [Python](https://docs.zeroc.com/ice/3.8/greeter-example/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/greeter-example/ruby.md), and [Swift](https://docs.zeroc.com/ice/3.8/greeter-example/swift.md).

Writing a client-server application with Ice does not take much code. See for yourself!

In this example, we describe how to write a simple client-server application, step by step.

This application is a typical Greeter: a server hosts a Greeter object that produces custom greetings, and the client calls the server to get these greetings. Even though it’s simple, this application demonstrates best practices and provides a good foundation for starting any Ice project.

We present this example in the following sections:

> **C++, C#, Java, Python, and Swift**
>
> 1. **Using Slice** How to use the [Slice IDL](https://docs.zeroc.com/ice/3.8/slice.md) to define a contract between clients and servers.
> 2. **Writing a server** How to implement Ice objects and host them in a server.
> 3. **Writing a client** How to write a client that communicates with an Ice server.
>
> We write the server first: a client has nothing to call until a server is running.

> **MATLAB, PHP, and Ruby**
>
> 1. **Using Slice** How to use the [Slice IDL](https://docs.zeroc.com/ice/3.8/slice.md) to define a contract between clients and servers.
> 2. **Writing a client** How to write a client that communicates with an Ice server.
>
> This example has no server section for this language mapping. You can run the Greeter server from C++, C#, Java, Python or Swift, and call it from the client you write here.

> **JavaScript**
>
> 1. **Using Slice** - How to use the [Slice IDL](https://docs.zeroc.com/ice/3.8/slice.md) to define a contract between clients and servers.
> 2. **Writing a client** - How to write a Node.js client that communicates with an Ice server.
> 3. **Writing a browser client** - How to write a client that runs in a web browser.
>
> This example has no server section for this language mapping. You can run the Greeter server from C++, C#, Java, Python or Swift, and call it from the client you write here.

> **C++**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/cpp/Ice/greeter), alongside several other demo programs.

> **C#**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/csharp/Ice/Greeter), alongside several other demo programs.

> **Java**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/java/Ice/greeter), alongside several other demo programs.

> **JavaScript**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/js/Ice/greeter), alongside several other demo programs.

> **MATLAB**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/matlab/Ice/greeter), alongside several other demo programs.

> **PHP**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/php/Ice/greeter), alongside several other demo programs.

> **Python**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/python/Ice/greeter), alongside several other demo programs.

> **Ruby**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/ruby/Ice/greeter), alongside several other demo programs.

> **Swift**
>
> The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/swift/Ice/Greeter), alongside several other demo programs.
