Frequently Asked Questions
By default, the demo programs that ship with Ice assume that you will run client and server on the same host. This behavior is controlled by two configuration files, config.client and config.server. For example, here is the relevant line for the server configuration of the hello demo:
Hello.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001
This says that the server’s object adapter named Hello will listen for incoming requests on port 10000 for UDP and TCP, and on port 10001 for SSL. Because this configuration does not use the -h option to explicitly specify an interface, the server binds itself to all network interfaces on its machine.
The corresponding entry for client looks like this:
Hello.Proxy=hello:tcp -p 10000:udp -p 10000:ssl -p 10001
This configures the proxy that is used by the client to make an invocation. Again, because the configuration does not use the -h option, the client will try all network interfaces on its machine when it tries to reach the server.
If you want to run client and server on different machines, you need to modify the configuration of the client to specify the server’s machine. For example, if the server runs on host www.zeroc.com, you can modify the client configuration to specify that machine:
Hello.Proxy=hello:tcp -h www.zeroc.com -p 10000:udp -h www.zeroc.com -p 10000:
ssl -h www.zeroc.com -p 10001
This configuration assumes that the DNS for the client can correctly resolve the domain name www.zeroc.com; if that is not the case, you can also use an IP address instead of a domain name.
Because you can configure a separate endpoint for each protocol, you can also create more complex configurations. For example, for a machine with separate interfaces for an external network and an internal network, you could use a server configuration as follows:
Hello.Endpoints=tcp –h internal.zeroc.com 0p 10000:udp -h internal.zeroc.com -p 7859:
ssl –h external.zeroc.com -p 10001
With this endpoint specification, the server will accept TCP and UDP requests only on the internal interface, at ports 10000 and 7859, respectively, and will accept SSL requests only on the external interface, at port 10001.
Regardless of what configuration you use, if a client cannot reach the server, the first thing to do is to run both client and server with --Ice.Trace.Network=2 and check that the endpoint that the client tries to connect to matches the endpoint at which the server listens. If not, the fault is inevitably in the endpoint configuration of either client or server (or both): the configurations must match for the client to be able to reach the server.
Instead of configuring endpoints manually, you can also let IceGrid take care of port allocation for you. Please check the Ice Manual for details.