---
title: "Object Adapter Endpoints"
url: https://docs.zeroc.com/ice/3.8/runtime/dispatch/object-adapter-endpoints
language: java
docs_index: https://docs.zeroc.com/llms.txt
---

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

# Object Adapter Endpoints

Programming language: Java. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/dispatch/object-adapter-endpoints/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/dispatch/object-adapter-endpoints/csharp.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/dispatch/object-adapter-endpoints/js.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/dispatch/object-adapter-endpoints/python.md), [Swift](https://docs.zeroc.com/ice/3.8/runtime/dispatch/object-adapter-endpoints/swift.md).

An object adapter has two sets of [endpoints](https://docs.zeroc.com/ice/3.8/runtime/endpoint-syntax/java.md):

- Its *physical endpoints* are the endpoints on which it listens for connections.
- Its *published endpoints* are the endpoints it embeds in the direct proxies it creates, and the endpoints it registers with the [location service](https://docs.zeroc.com/ice/3.8/runtime/locators/locator-semantics-for-servers.md) when it has an adapter ID.

## Physical Object Adapter Endpoints

You specify the endpoints on which an object adapter listens when you [create it](https://docs.zeroc.com/ice/3.8/runtime/dispatch/creating-an-object-adapter/java.md): with the [*name*.Endpoints](https://docs.zeroc.com/ice/3.8/property-reference/object-adapter-properties/java.md#adapter.endpoints) property for `createObjectAdapter`, or as an argument of `createObjectAdapterWithEndpoints`. We recommend a single endpoint, despite the plural in these names: several endpoints provide no real benefit.

An [endpoint](https://docs.zeroc.com/ice/3.8/runtime/endpoint-syntax/java.md) consists of a transport, usually followed by a host and a port. For example, the following object adapter listens for TCP connections on address `10.0.1.1` and port `9999`:

```config
MyAdapter.Endpoints=tcp -h 10.0.1.1 -p 9999
```

The `-h` option selects the network interfaces on which the object adapter listens:

- With an IP address, the object adapter listens only on the network interface with this address: with `-h 10.0.1.1`, it does not listen on the loopback interface.
- With `*`, it listens on all network interfaces, including the loopback interface.
- Without `-h`, it uses the host set by the [Ice.Default.Host](https://docs.zeroc.com/ice/3.8/property-reference/ice-default-properties/java.md#ice.default.host) property, or listens on all network interfaces when this property is not set.

Specify an IP address, not a DNS name. See [IP Address Syntax](https://docs.zeroc.com/ice/3.8/runtime/endpoint-syntax/java.md#ip-address-syntax) for the details of the `-h` option.

The `-p` option sets the port. Without `-p`, the operating system picks a port each time you create the object adapter, so a direct proxy that a client kept from a previous run may no longer reach it. Set a fixed port when clients reach the object adapter with direct proxies. With indirect proxies, such as with [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md), you can let the operating system pick the port.

## Published Object Adapter Endpoints

An object adapter gets its published endpoints from its [adapter.PublishedEndpoints](https://docs.zeroc.com/ice/3.8/property-reference/object-adapter-properties/java.md#adapter.publishedendpoints) property. When this property is not set, the object adapter derives its published endpoints from its physical endpoints:

1. It discards the loopback and multicast endpoints, unless all the endpoints are loopback or multicast.
2. It replaces the host in each remaining endpoint with the published host.
3. It removes duplicate endpoints.

The published host is the value of the [adapter.PublishedHost](https://docs.zeroc.com/ice/3.8/property-reference/object-adapter-properties/java.md#adapter.publishedhost) property. When this property is not set, the object adapter uses the host name of the current host, or keeps the host of each endpoint when all the endpoints are loopback or multicast.

> **Note**
>
> On Android, Ice cannot determine the host name, so set `adapter.PublishedHost` when clients use the proxies this object adapter creates.

For example, on host `Sun1`, the following object adapter has the published endpoint `tcp -h Sun1 -p 9999`:

```config
MyAdapter.Endpoints=tcp -p 9999
```

Set `adapter.PublishedHost` when clients reach this host under another name or address:

```config
MyAdapter.Endpoints=tcp -h 10.0.1.1 -p 9999
MyAdapter.PublishedHost=sun1.example.com
```

The published endpoint is then `tcp -h sun1.example.com -p 9999`.

Set `adapter.PublishedEndpoints` when clients reach the object adapter through another host and port. For example, with a firewall that forwards connections on port `25000` of host `corpfw` to the object adapter:

```config
MyAdapter.Endpoints=tcp -h 10.0.1.1 -p 9999
MyAdapter.PublishedEndpoints=tcp -h corpfw -p 25000
```

When replicated servers return direct proxies to their clients, set the same published endpoints in all these servers, so that each proxy carries the endpoints of [all the replicas](https://docs.zeroc.com/ice/3.8/runtime/invocation/proxies-to-replicated-objects.md). For example, the servers on hosts `Sun1` and `Sun2` both set:

```config
MyAdapter.PublishedEndpoints=tcp -h Sun1 -p 9999:tcp -h Sun2 -p 9999
```

Do not list the endpoints of other servers when the object adapter registers its published endpoints with a location service, such as [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md): each replica registers only its own endpoints.

## A Router's Effect on Object Adapter Endpoints

When an object adapter is configured with a router, its published endpoints are the endpoints of the router's server proxy, and you can't set other published endpoints. See [Routers](https://docs.zeroc.com/ice/3.8/runtime/invocation/routers/java.md).

## See Also

- [Object Adapter Properties](https://docs.zeroc.com/ice/3.8/property-reference/object-adapter-properties/java.md)
- [Ice.Default.\*](https://docs.zeroc.com/ice/3.8/property-reference/ice-default-properties/java.md)
- [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md)
- [Routers](https://docs.zeroc.com/ice/3.8/runtime/invocation/routers/java.md)
