Object Adapter Endpoints
5 min read
5 min read
5 min read
5 min read
5 min read
An object adapter does not listen for connections. Its published endpoints are the endpoints it embeds in the direct proxies it creates.
An object adapter has two sets of endpoints:
- 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 when it has an adapter ID.
Physical Object Adapter Endpoints
You specify the endpoints on which an object adapter listens when you create it: with the name.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 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:
MyAdapter.Endpoints=tcp -h 10.0.1.1 -p 9999The -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 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 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, you can let the operating system pick the port.
Published Object Adapter Endpoints
An object adapter gets its published endpoints from its adapter.PublishedEndpoints property. When this property is not set, the object adapter has no published endpoints.
An object adapter gets its published endpoints from its adapter.PublishedEndpoints property. When this property is not set, the object adapter derives its published endpoints from its physical endpoints:
- It discards the loopback and multicast endpoints, unless all the endpoints are loopback or multicast.
- It replaces the host in each remaining endpoint with the published host.
- It removes duplicate endpoints.
The published host is the value of the 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.
For example, on host Sun1, the following object adapter has the published endpoint tcp -h Sun1 -p 9999:
MyAdapter.Endpoints=tcp -p 9999Set adapter.PublishedHost when clients reach this host under another name or address:
MyAdapter.Endpoints=tcp -h 10.0.1.1 -p 9999MyAdapter.PublishedHost=sun1.example.comThe 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:
MyAdapter.Endpoints=tcp -h 10.0.1.1 -p 9999MyAdapter.PublishedEndpoints=tcp -h corpfw -p 25000When 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. For example, the servers on hosts Sun1 and Sun2 both set:
MyAdapter.PublishedEndpoints=tcp -h Sun1 -p 9999:tcp -h Sun2 -p 9999Do not list the endpoints of other servers when the object adapter registers its published endpoints with a location service, such as IceGrid: 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.