Home Help Center

How to reduce the connections between client and server?

Pierre.SironPierre.Siron Member Pierre SironOrganization: ONERAProject: CERTI (http://savannah.nongnu.org/projects/certi/)
Hi,
In the "callback" demo included in the Ice-3.2.0,I found that a lot of connections established:

Firstly,I run the server (and none client joined currently):

Except listening at the 10000 port, the server open 2 ports in addition and link each other.

Secondly,I run the first client:

4 additional ports opened and make 2 connections.Because I run the server and client on the same computer, so I don't know exactly how they linked.

Whenever I run a new client, 2 additional connections established.This give me some puzzle.

Ok,here is my questions:

What is the usage of the initial connection that established before any client connected?

What is the usage of the additional two connection when a new client join?Can I avoid them to save some network resource?

Of course,I take notice of another demo named "bidir". In this demo the additional connections reduced , but there are some other questions which I would like to create a new thread to discuss them.

Regards
Pierre Siron

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Pierre,

    See this FAQ for details on how and why Ice opens these ports.

    In the callback demo, both the client and server are listening on a given port for incoming connections. When the client starts, it establishes an outgoing connection to the server and when the server dispatches the initiateCallback() method it then initiates a connection to the client to call it back (the callback() invocation). So there's one connection for client->server communications and another one for server->client communications.

    With the bidir demo, the client->server connection is also used for server->client communications. So only one connection is necessary. However, this means that the server can call back on the client only if this connection already exists.

    Let us know if you need more information!

    Cheers,
    Benoit.
Sign In or Register to comment.