Пример #1
0
 //查询调度台IP
 public static bool GetDispatcherAddress(out List<string> lstIP)
 {
     lstIP = new List<string>();
     MBoxSDK.ConfigSDK.tagTrapServer TrapServer = new MBoxSDK.ConfigSDK.tagTrapServer();
     bool b = MBoxSDK.ConfigSDK.MBOX_GetDispatcherAddress(Global.Params.BoxHandle, ref TrapServer);
     string strIP1 = System.Text.Encoding.Default.GetString(TrapServer.trapServer1).Replace("\0", "");
     string strIP2 = System.Text.Encoding.Default.GetString(TrapServer.trapServer2).Replace("\0", "");
     string strIP3 = System.Text.Encoding.Default.GetString(TrapServer.trapServer3).Replace("\0", "");
     string strIP4 = System.Text.Encoding.Default.GetString(TrapServer.trapServer4).Replace("\0", "");
     if (strIP1 != "") lstIP.Add(strIP1);
     if (strIP2 != "") lstIP.Add(strIP2);
     if (strIP3 != "") lstIP.Add(strIP3);
     if (strIP4 != "") lstIP.Add(strIP4);
     return b;
 }
Пример #2
0
     //设置调度台IP
     public static bool SetDispatcherAddress(List<string> lstIP)
     {
         bool b=true;  //不设置时返回true
         MBoxSDK.ConfigSDK.tagTrapServer TrapServer = new MBoxSDK.ConfigSDK.tagTrapServer();
         if (lstIP.Count >= 1)
         {
             TrapServer.trapServer1 = new byte[MBoxSDK.ConfigSDK.MAX_IP4];
             System.Text.ASCIIEncoding.ASCII.GetBytes(lstIP[0]).CopyTo(TrapServer.trapServer1, 0);  //对端IP地址 
         }
         if (lstIP.Count >= 2)
         {
             TrapServer.trapServer2 = new byte[MBoxSDK.ConfigSDK.MAX_IP4];
             System.Text.ASCIIEncoding.ASCII.GetBytes(lstIP[1]).CopyTo(TrapServer.trapServer2, 0);  //对端IP地址 
 
         }
         if (lstIP.Count >= 3)
         {
             TrapServer.trapServer3 = new byte[MBoxSDK.ConfigSDK.MAX_IP4];
             System.Text.ASCIIEncoding.ASCII.GetBytes(lstIP[2]).CopyTo(TrapServer.trapServer3, 0);  //对端IP地址 
         }
         if (lstIP.Count >= 4)
         {
             TrapServer.trapServer4 = new byte[MBoxSDK.ConfigSDK.MAX_IP4];
             System.Text.ASCIIEncoding.ASCII.GetBytes(lstIP[3]).CopyTo(TrapServer.trapServer4, 0);  //对端IP地址 
         }
         if(lstIP.Count>0)
            b = MBoxSDK.ConfigSDK.MBOX_SetDispatcherAddress(Global.Params.BoxHandle, TrapServer);
         return b;
     }