|
|
|
|||||
|
Hi
When the client is disconnected but the processing on the server hasn't terminated, how does the server sense the client's disconnection when the processing returns? Can the server sense the client's disconnection as soon as it's disconnected? If so, what should I do? Thanks for any help! |
|
|||||
|
To be detailed, what I want is to do some operations when the rpc returns normally and do others when abnormally(for example, free some resource when the client is disconnected before the rpc returns). Shall I gain my ends? How?
|
|
||||||
|
This is a general problem with all distributed systems, and nothing specific to Ice. Strategies such a relying on the network connection breaking down are not reliable, and should be avoided. A better strategy is to use sessions. See Michi's article "The Grim Reaper" for details: http://www.zeroc.com/newsletter/issue3.pdf
|
|
|||||
|
Thanks for all replying!
In my early TCP/IP programming with socket, when the server returns something to the client, using send() for example, if the client is disconnected at that time, the server will sense it as a timeout. So I have thought that ICE should have the same funtion. |
|
||||||
|
That's true, if you get an error while sending a response. However, since there was then just a request from the client, it's unlikely that the response would fail. If the client just disappears, the TCP/IP stack cannot give you a reliable notification about the client being dead.
Note that you do get an exception if the sender calls back the client. This is also how the Grim Reaper example works. |
|
|||||
|
But when the client is disconnected in the course of rpc, the server won't sense it and will continue to complete the rpc code. I know the thread will be released as soon as the rpc code ends, but I don't know whether the server will maintain a TCP/IP link in lower layer. If so, how long will it be? Can we configure it and how? If there are too many useless links, each of which occupies about 128K memory, the server will be exhausted.
|
|
||||||
|
Hi,
The server closes the TCP/IP connection as soon as it detects it. When this occurs depends very much on how the connection is closed and your network infrastructure. For example, if the client destroys the communicator while it still has a request being processed by the server, the connection is closed gracefully and the server will close the connection as soon as it receives the close connection message. However, if the client crashes and is behind several routers, the server will most likely not detect the connection closure in a timely manner. The server will eventually close the connection if sending a response fails with a timeout or if the connection is idle and server ACM is enabled (it's disabled by default). See 28.4.6 Endpoints in the Ice manual for more information on setting a timeout on the object adapter physical endpoints and see here for more information on ACM. I also recommend reading the Connection Management chapter for detailed information on how Ice manages its connections. Also, note that you can set Ice.Trace.Network=2 in your client or server configuration file to see connection lifecycle information. Cheers, Benoit. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| get client's IP using glacier2router | Andrew | Help Center | 4 | 04-17-2008 05:55 AM |
| Can Ice server get the ICE client's IP? | richardma | Help Center | 1 | 12-23-2005 09:05 AM |
| How can I know disconnection status ? | laotee | Help Center | 6 | 06-02-2005 06:29 AM |
| How to get client's IP address | zephyr007 | Help Center | 4 | 12-28-2004 10:58 AM |
| server communicate with client without client's request | chunlin | Help Center | 1 | 09-12-2003 08:18 AM |