- Timestamp:
- Jan 26, 2011, 5:45:02 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/BMXNetLib.cs
r1063 r1082 1027 1027 try 1028 1028 { 1029 string sContext = this.AppContext; 1030 this.AppContext = "BMXRPC"; 1029 /* 3110109 -- smh Commented out for performance issues. 1030 /*string sContext = this.AppContext; 1031 this.AppContext = "BMXRPC";*/ 1031 1032 Variable = Variable.Replace("^","~"); 1032 1033 string sRet = "0"; … … 1035 1036 sRet = TransmitRPC("BMX LOCK", sParam); 1036 1037 bRet = (sRet == "1")?true:false; 1037 this.AppContext = sContext; 1038 /* 3110109 -- smh Commented out for performance issues. 1039 /*this.AppContext = sContext;*/ 1038 1040 return bRet; 1039 1041 } … … 1077 1079 public string TransmitRPC(string sRPC, string sParam, int nLockTimeOut) 1078 1080 { 1079 try 1080 { 1081 try 1082 { 1083 if (m_bConnected == false) 1084 { 1085 throw new BMXNetException("BMXNetLib.TransmitRPC failed because BMXNetLib is not connected to RPMS."); 1086 } 1087 Debug.Assert(m_cDUZ != ""); 1088 Debug.Assert(m_pCommSocket != null); 1089 1090 string sOldAppContext = ""; 1091 if (sRPC.StartsWith("BMX")&&(this.m_cAppContext != "BMXRPC")) 1092 { 1093 sOldAppContext = this.m_cAppContext; 1094 this.AppContext = "BMXRPC"; 1095 } 1096 string sMult = ""; 1097 string sSend = ADEBLDMsg(m_cHDR, sRPC, sParam, ref sMult); 1098 SendString(m_pCommSocket, sSend, sMult); 1099 #if TRACE 1100 DateTime sendTime = DateTime.Now; 1101 Debug.Write("TransmitRPC Sent: " + sSend.Replace((char) 30, (char) 10) + "\n"); 1081 lock (this) // This method CANNOT be executed simultaneously! 1082 { 1083 try 1084 { 1085 try 1086 { 1087 if (m_bConnected == false) 1088 { 1089 throw new BMXNetException("BMXNetLib.TransmitRPC failed because BMXNetLib is not connected to RPMS."); 1090 } 1091 Debug.Assert(m_cDUZ != ""); 1092 Debug.Assert(m_pCommSocket != null); 1093 1094 string sOldAppContext = ""; 1095 /* 3110109 -- smh Commented out for performance issues. 1096 if (sRPC.StartsWith("BMX")&&(this.m_cAppContext != "BMXRPC")) 1097 { 1098 sOldAppContext = this.m_cAppContext; 1099 this.AppContext = "BMXRPC"; 1100 } 1101 */ 1102 string sMult = ""; 1103 string sSend = ADEBLDMsg(m_cHDR, sRPC, sParam, ref sMult); 1104 SendString(m_pCommSocket, sSend, sMult); 1105 #if TRACE 1106 DateTime sendTime = DateTime.Now; 1107 int threadid = Thread.CurrentThread.ManagedThreadId; 1108 Debug.Write("TransmitRPC Sent: (T:" + threadid + ")" + sSend.Replace((char)30, (char)10) + "\n"); 1102 1109 #endif 1103 string strResult = ReceiveString(m_pCommSocket);1110 string strResult = ReceiveString(m_pCommSocket); 1104 1111 #if TRACE 1105 DateTime receiveTime = DateTime.Now;1106 Debug.Write("TransmitRPC Received: " + strResult.Replace((char) 30, (char)10) + "\n");1107 TimeSpan executionTime = receiveTime - sendTime;1108 Debug.Write("Execution Time: " + executionTime.TotalMilliseconds + " ms.\n");1109 Debug.Write("-------------------------------------------------------\n");1112 DateTime receiveTime = DateTime.Now; 1113 Debug.Write("TransmitRPC Received: (T:" + threadid + ")" + strResult.Replace((char)30, (char)10) + "\n"); 1114 TimeSpan executionTime = receiveTime - sendTime; 1115 Debug.Write("Execution Time: " + executionTime.TotalMilliseconds + " ms.\n"); 1116 Debug.Write("-------------------------------------------------------\n"); 1110 1117 #endif 1111 if (sOldAppContext != "") 1118 /* /* 3110109 -- smh Commented out for performance issues. 1119 * if (sOldAppContext != "") 1112 1120 { 1113 1121 this.AppContext = sOldAppContext; 1114 1122 } 1115 return strResult; 1116 } 1117 catch (Exception ex) 1118 { 1119 if (ex.Message == "Unable to write data to the transport connection.") 1120 { 1121 m_bConnected = false; 1122 } 1123 throw ex; 1124 } 1125 finally 1126 { 1127 } 1128 } 1129 catch (ApplicationException aex) 1130 { 1131 // The writer lock request timed out. 1132 Debug.Write("TransmitRPC writer lock request timed out.\n"); 1133 throw aex; 1134 } 1135 catch (Exception OuterEx) 1136 { 1137 throw OuterEx; 1138 } 1123 */ 1124 return strResult; 1125 } 1126 catch (Exception ex) 1127 { 1128 if (ex.Message == "Unable to write data to the transport connection.") 1129 { 1130 m_bConnected = false; 1131 } 1132 throw ex; 1133 } 1134 finally 1135 { 1136 } 1137 } 1138 catch (ApplicationException aex) 1139 { 1140 // The writer lock request timed out. 1141 Debug.Write("TransmitRPC writer lock request timed out.\n"); 1142 throw aex; 1143 } 1144 catch (Exception OuterEx) 1145 { 1146 throw OuterEx; 1147 } 1148 } 1139 1149 } 1140 1150
Note:
See TracChangeset
for help on using the changeset viewer.