Changeset 1193
- Timestamp:
- May 26, 2011, 5:45:42 AM (14 years ago)
- Location:
- BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet.EHR/BMXNetEhrSessionConnection.cs
r1146 r1193 20 20 get { return 60000; } 21 21 set { } 22 } 23 24 public override Encoding ConnectionEncoding 25 { 26 get 27 { 28 return System.Text.Encoding.Default; 29 } 30 set 31 { 32 ConnectionEncoding = value; 33 } 22 34 } 23 35 -
BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet.WinForm/LoginProcess.cs
r1146 r1193 282 282 public bool AttemptUserInputLogin(string aDialogTitle, int maxAttempts, bool enableConnectionManagement,IWin32Window aUiOwnerForPositioningDialog) 283 283 { 284 //test sam 285 //Framework.SocketBroker.Open( 286 //Framework.SocketBroker.PrimaryRemoteSession.TransmitRPC("XUS INTRO TEXT","","XUS SIGNON"); 287 //test sam 288 284 289 this.MaxAttempts = maxAttempts; 285 290 RpmsLoginView view = (RpmsLoginView)new RpmsLoginDialog(); -
BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet.WinForm/WinFramework.cs
r1146 r1193 657 657 public LoginProcess CreateLoginProcess() 658 658 { 659 /* 660 //sam test 661 BMXNetSocketConnectionSpec spec = new BMXNetSocketConnectionSpec(); 662 spec.Server = this.ConnectionSettings.DefaultConnectionSpec.Server; 663 spec.Port = this.ConnectionSettings.DefaultConnectionSpec.Port; 664 665 var broker = new BMXNetSocketBroker(); 666 broker.ConnectionSpec = spec; 667 var initcxn = new BMXNetSessionSocketConnection(broker); 668 initcxn.ConnectionSpec = spec; 669 initcxn.OpenConnectionCommon(); 670 initcxn.IsConnected = true; 671 string txt = initcxn.TransmitRPC("XUS INTRO TEXT", ""); 672 //end test 673 */ 659 674 return new LoginProcess(this); 660 675 -
BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet/Net/BMXNetSessionSocketConnection.cs
r1180 r1193 10 10 using System.Threading; 11 11 using System.Timers; 12 using System.Linq; 12 13 13 14 namespace IndianHealthService.BMXNet.Net … … 115 116 Port = "All", 116 117 Transport = "All")] 117 118 protected virtual void OpenConnectionCommon() 118 119 { 119 120 try … … 346 347 #endif 347 348 349 /******************INIT*****************/ 348 350 NetworkStream ns = tcpClient.GetStream(); 349 351 ns.ReadTimeout = this.ReceiveTimeout; //Timeout; throw exception automatically if we time out. 350 352 353 /*************SECURITY S-PACKET READ***********************/ 354 int secPackLen = ns.ReadByte(); //Read S-Pack Length Byte 355 byte[] secPackContents = new byte[secPackLen];; 356 if (secPackLen > 0) 357 { 358 ns.Read(secPackContents, 0, secPackLen); 359 } 360 361 /****************ERROR S-PACKET READ******************/ 362 int errPackLen = ns.ReadByte(); //Read S-Pack Length Byte 363 byte[] errPackConents = new byte[errPackLen];; 364 if (errPackLen > 0) 365 { 366 ns.Read(errPackConents, 0, errPackLen); 367 } 368 369 //If either one of these exists, then we have an error on the Mumps Database 370 if (secPackLen > 0 || errPackLen > 0) 371 { 372 //We still have to read the Data to empty the tcp OS buffers even if we have security/errors in the DB 373 while (ns.DataAvailable) ns.ReadByte() ; //while loop to empty the buffer -- this is theoretically slow, but that's not important here 374 375 //Now decode them. 376 string secString = ConnectionEncoding.GetString(secPackContents); 377 string errString = ConnectionEncoding.GetString(errPackConents); 378 throw new BMXNetException("Mumps Database Security/Error: " + secString + " | " + errString); 379 } 380 381 /*****************DATA STREAM READ*******************/ 382 //Data stream from VISTA ends when we find the EOT (ASCII 4) character 351 383 MemoryStream mStream = new MemoryStream(1500); // Auto expanding memory storage for what we receive 352 int numberOfBytesRead = 0; 384 int numberOfBytesRead = 0; 353 385 bool bFinished = false; // Have we found the End of Transmission (ASCII 4) yet? 354 386 … … 362 394 else mStream.Write(bReadBuffer, 0, numberOfBytesRead - 1); //otherwise, number of bytes minus the $C(4) at the end 363 395 } 396 397 //At this point, we are done reading from the Network Stream. Now we have to decode the data. 364 398 365 //Read Security S-Packet 366 mStream.Seek(0, SeekOrigin.Begin); 367 int secLength = mStream.ReadByte(); 368 byte[] secBytes = new byte[secLength]; 369 if (secLength > 0) 370 { 371 mStream.Read(secBytes, 0, secLength); 372 } 373 374 //Read Error S-Packet 375 mStream.Seek(secLength + 1, SeekOrigin.Begin); 376 int errLength = mStream.ReadByte(); 377 byte[] errBytes = new byte[errLength]; 378 if (errLength > 0) 379 { 380 mStream.Read(errBytes, 0, errLength); 381 } 382 383 //If either one of these exists, then we have an error on the Mumps Database 384 if (secLength > 0 || errLength > 0) 385 { 386 string errString = ConnectionEncoding.GetString(secBytes); 387 string appString = ConnectionEncoding.GetString(errBytes); 388 throw new BMXNetException("Mumps Database Security/Error: " + errString + " | " + appString); 389 } 390 391 //No Errors. Decode the entire message starting from after the S packets above 392 string sReadBuffer = ConnectionEncoding.GetString(mStream.ToArray(), secLength + errLength + 2, mStream.ToArray().Length - (secLength + errLength + 2)); //decode 399 //Decode the entire message. 400 string sReadBuffer = ConnectionEncoding.GetString(mStream.ToArray()); //decode 393 401 394 402 String decodedReceiveString = this.DecodeReceiveString(sReadBuffer); … … 636 644 this.SendString(this.Socket, ADEBLDMsg(m_cHDR, "BMXGetFac", aDuz)); 637 645 return this.ReceiveString(this.Socket); 638 #if DEBUG639 _watch = new Stopwatch();640 _watch.Start();641 #endif642 643 646 } 644 647 catch (BMXNetException bmxEx)
Note:
See TracChangeset
for help on using the changeset viewer.