| | |
| | | netsdk.CLIENT_SetAutoReconnect(haveReConnect, null); |
| | | |
| | | //设置登录超时时间和尝试次数,可选 |
| | | int waitTime = 5000; //登录请求响应超时时间设置为5S |
| | | int waitTime = 2000; //登录请求响应超时时间设置为5S |
| | | int tryTimes = 1; //登录时尝试建立链接1次 |
| | | netsdk.CLIENT_SetConnectTime(waitTime, tryTimes); |
| | | |
| | | // 设置更多网络参数,NET_PARAM的nWaittime,nConnectTryNum成员与CLIENT_SetConnectTime |
| | | // 接口设置的登录设备超时时间和尝试次数意义相同,可选 |
| | | NetSDKLib.NET_PARAM netParam = new NetSDKLib.NET_PARAM(); |
| | | netParam.nConnectTime = 10000; // 登录时尝试建立链接的超时时间 |
| | | netParam.nConnectTime = 2000; // 登录时尝试建立链接的超时时间 |
| | | netParam.nGetConnInfoTime = 3000; // 设置子连接的超时时间 |
| | | netParam.nGetDevInfoTime = 3000;//获取设备信息超时时间,为0默认1000ms |
| | | netsdk.CLIENT_SetNetworkParam(netParam); |
| | |
| | | //NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY pstOutParam = new NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY(); |
| | | LLong m_hLoginHandle = netsdk.CLIENT_LoginEx2(m_strIp, m_nPort, m_strUser, m_strPassword, 0, null, lpDeviceInfo, nError); |
| | | //m_hLoginHandle=netsdk.CLIENT_LoginWithHighLevelSecurity(pstInParam, pstOutParam); |
| | | if (m_hLoginHandle.longValue() == 0) { |
| | | log.debug("Login Failed [" + m_strIp + ":" + m_nPort + "],错误码:" + getErrorCodePrint()); |
| | | } else { |
| | | log.debug("Login Success [ " + m_strIp + ":" + m_nPort + " ]"); |
| | | } |
| | | //if (m_hLoginHandle.longValue() == 0) { |
| | | // log.debug("Login Failed [" + m_strIp + ":" + m_nPort + "],错误码:" + getErrorCodePrint()); |
| | | //} else { |
| | | // log.debug("Login Success [ " + m_strIp + ":" + m_nPort + " ]"); |
| | | //} |
| | | return m_hLoginHandle; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |