.Net remoting connection timeout RRS feed

  • Question

  • Dear all,

    I have the server and client program. The client will check the connection to the server by using below function. When the client machine is unplugged, it will give faster response to alert disconnected. But when the server machine is unplugged, the below function of client machine seems wait for a long time (1-2 minutes). How to amend to have faster response? as client machine activities depends on server connection. It will make the client machine seems to be halted when there is no connection.

    Most people have gotten around this by  making the call on a separate thread, and when the call does not complete after a certain amount of time, return execution to the main thread and mark the server as timed out. But I don't know how to do with my case. Could you tell me how to incorporate with my case?

    public ServerConnectionVO getServerConnection(bool updateTerminalStatus)
                    object rmtStoreStatusObj =
                        Activator.GetObject(typeof(RMT_StoreStatus), url + "StoreStatus");
                        RMT_StoreStatus storeStatus = (RMT_StoreStatus)rmtStoreStatusObj;
                        return storeStatus.GetServerConnection(PropertiesVO.terminalID, updateTerminalStatus);
                    catch (System.Net.Sockets.SocketException se)
                    catch (System.InvalidOperationException ie)
                catch (System.Runtime.Remoting.RemotingException ee)
          , "COM_MessageSender", true);
                catch (Exception ex)
          , CLASS_NAME, true);
                return null;

    • Moved by Lisa Zhu Wednesday, February 20, 2013 9:41 AM networking and communication
    Friday, February 15, 2013 2:55 AM

All replies

  • So by default a socket open request has a default time-out associated.  In order to fail it faster that value has to be changed before you attempt the open.

    So this line of code gives us a hint:

    I am guessing that this function opens the socket to the remote host.  But does the storeStatus class have a way for you to set the timeout, or rather a parameter within the GetServerconnection method?  If not you'll either have to write your own routine of have the paremeter exposed in existing class.

    JP Cowboy Coders Unite!

    Friday, February 15, 2013 3:50 AM
  • I find out that (my example is ) .net remoting does not have connection timeout to be set, neither in storeStatus class or  rather a parameter within the GetServerconnection method.

    How can I do then?

    Friday, February 15, 2013 7:01 AM
  • Hi Raymond,

    From your description, I ‘d like to move this post to  the most related forum for better support. You may e more luck getting answers.

    Thanks for your understanding.


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 20, 2013 9:41 AM
  • Hi Raymond,

    I am not sure which channel you are using in RMT_StoreStatus, but TCP Channel in .NET Framework 1.1 does not have Timeout Property.

    However, you can still implement your own timeout property using the sample provided in the same link

    The Timeout property is available from .NET framework 2.0.

    If the Remoting call hung for some reason and never timed out, probably you could implement your own timeout as below

    Thread t = new Thread(new ThreadStart(timeoutCall));

    //Sleep the timeout value

    // if it's
    still alive after 2 seconds
    // let get rid of the call
    if (t.IsAlive)

    public void timeoutCall()
    Remoting proxy



    • Edited by ShashiK Monday, March 4, 2013 7:37 PM
    Monday, March 4, 2013 7:36 PM