/// <summary> /// Connect to the application server using the RSO method. /// </summary> private void ORConnectRSO() { //Ensure we have a Session. if (ORSession == null) { throw new SCPInvalidArgumentException(Constants.OR_SESSION_UNAVAILABLE_EXCEPTION_MESSAGE); } //If not connected then attempt to connect. if (ORSession.IsConnected == 0) { if (ImageName == null || ImageName.Length == 0) { throw new SCPInvalidArgumentException(Constants.INVALID_AKA_NAME_EXCEPTION_MESSAGE); } //If location not provided then default to current machine. if (Location == null || Location.Length == 0) { Location = System.Environment.MachineName; } //If routing not provided then default to empty string. if (Routing == null || Routing.Length == 0) { Routing = ""; } try { // Find host by name IPHostEntry iphostentry = Dns.GetHostEntry(Dns.GetHostName()); // Enumerate IP addresses string ipAddress = ""; foreach (IPAddress ipaddress in iphostentry.AddressList) { ipAddress = ipaddress.ToString(); } // Create OR ASO Session ORRSOClass rso = new ORRSOClass(); ORPDOClass byVal = new ORPDOClass(); ORPDOClass byRef = new ORPDOClass(); ORSession.v_user_name = System.Security.Principal.WindowsIdentity.GetCurrent().Name; ORSession.v_ip_address = ipAddress; ORSession.i_user_id = -1; object options = "0"; rso.UseASOLib = 1; rso.Initiate(AKAName, Flags, Location, Routing, 0, ref options); object remoteServer = rso; ORSession.AttachRSO(ref remoteServer); } catch (Exception ex) { throw new SCPConnectException(Constants.OR_SESSION_CONNECT_EXCEPTION_MESSAGE, ex); } } }