Results 1 to 3 of 3

Thread: Using callback on server after closing client

  1. #1
    adamsajdak is offline Registered User
    Name: Adam sajdak
    Organization: Univerisy of Science and Technology in Cracow
    Project: Distributed genetic algorithms computation
    Join Date
    Aug 2010
    Posts
    2

    Using callback on server after closing client

    Hi,
    I've just started working with ICE and I have serious problem just in the beginning. I have written working client and server, and server is able to communicate with specific client using callback. My problem is what happens when I close client without informing about that server(for example operating system has crashed). I know that after some time session will timeout( I am using Glacier2), but before that when server calls any callback method program hangs while trying to connect... So is there any method to check from server side if client is still connected, just having its callback proxy object?

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,445
    Hi Adam,

    Welcome to the forum.

    There's no reliable way for a server to determine whether a client is still connected. The best approach is to program defensively and assume that any invocation on the client might block. You should use asynchronous invocations if you want to avoid the possibility of blocking your server while it makes a callback to the client; Ice guarantees that asynchronous invocations never block, including during the connection establishment phase. I would also recommend that your server configure a timeout on its callback proxy.

    Regards,
    Mark

  3. #3
    adamsajdak is offline Registered User
    Name: Adam sajdak
    Organization: Univerisy of Science and Technology in Cracow
    Project: Distributed genetic algorithms computation
    Join Date
    Aug 2010
    Posts
    2
    Hi,
    thanks for the help. Now I'm using asynchronous calls. But there is yet another problem, on client side I'm using separate thread to constantly refresh session to be able to avoid destroying this session on server side. And everything works great during first connection, the client is stable connected to server for several time. Problem occurs when I close client(session manager destroys session) and connect it again... Server after some time destroys session as there would not be any pining thread on client side. And after that if I close server I got exception form pining thread that server is not available(which is normal behaviour).
    This is the code used in pinging thread:
    Code:
     while (work)
                {
                    try
                    {
                        router.refreshSession();
                        Thread.Sleep(1000);
                    }
                    catch (Exception e)
                    {
                        Console.Error.WriteLine(e);
                    
                    }
                }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 07-14-2010, 11:26 AM
  2. Replies: 6
    Last Post: 08-15-2007, 02:08 AM
  3. Replies: 1
    Last Post: 07-30-2005, 07:12 AM
  4. Wrong IP for client Callback
    By tony_h in forum Help Center
    Replies: 4
    Last Post: 09-30-2004, 09:13 AM
  5. Client Disconnect Callback
    By tony_h in forum Help Center
    Replies: 1
    Last Post: 09-21-2004, 11:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •