服务器断开连接后连接超时-希望更快的响应 [英] connectivity timeout after server disconnect -- Want Faster Response

查看:56
本文介绍了服务器断开连接后连接超时-希望更快的响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的

我有服务器和客户端程序.客户端将使用以下功能检查与服务器的连接.拔出客户端计算机后,它将对警报断开连接给出更快的响应.但是,当服务器计算机拔出时,以下内容 客户端计算机的功能似乎等待了很长时间(1-2分钟).如何修改才能有更快的反应?因为客户端计算机的活动取决于服务器连接.如果没有连接,它将使客户端计算机似乎停止运行.

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.

public ServerConnectionVO getServerConnection(bool updateTerminalStatus)
       {
          试试
           {
                            对象rmtStoreStatusObj =
                    Activator.GetObject(typeof(RMT_StoreStatus),url +"StoreStatus");
                            试试
                             {
                    RMT_StoreStatus storeStatus =(RMT_StoreStatus)rmtStoreStatusObj;
                   返回storeStatus.GetServerConnection(PropertiesVO.terminalID,updateTerminalStatus);
                             }
                            捕获(System.Net.Sockets.SocketException se)
                             {
                    System.Diagnostics.Debug.WriteLine(se);
                             }
                            捕获(System.InvalidOperationException即)
                             {
                    System.Diagnostics.Debug.WriteLine(ie);
                             }
           }
          捕获(System.Runtime.Remoting.RemotingException ee)
           {
                             StoreServer.VO.Logger.POSLogger.info(ee,"COM_MessageSender",true);
           }
           catch(异常例外)
           {
                             POSLogger.info(ex,CLASS_NAME,true);
           }
          返回null;
       }

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

推荐答案

在尝试连接服务器时是否使用某种超时方式?

Are you using some kind of an timeout when you try to connect to server?

我的意思是,如果您想要更快的答案,那么可能的解决方案是设置一些必须建立连接的超时时间.

I mean if you want quicker answers then the possible solution is that you set some timeout in which the connection must be established.


这篇关于服务器断开连接后连接超时-希望更快的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆