Exemplo n.º 1
0
 /// <summary><see cref="Ch.Elca.Iiop.IClientTransportFactory.CreateTransport(IIorProfile)"/></summary>
 public IClientTransport CreateTransport(IIorProfile targetProfile)
 {
     if (targetProfile.ProfileId == TAG_INTERNET_IOP.ConstVal)
     {
         IInternetIiopProfile iiopProf    = (IInternetIiopProfile)targetProfile;
         IPAddress            asIpAddress = ConvertToIpAddress(iiopProf.HostName);
         IClientTransport     result;
         if (asIpAddress == null)
         {
             ArrayList hostNames = new ArrayList();
             ArrayList ports     = new ArrayList();
             hostNames.Add(iiopProf.HostName);
             ports.Add(iiopProf.Port);
             foreach (TaggedComponent taggedComponent in
                      iiopProf.TaggedComponents.GetComponents(ALTERNATE_IIOP_ADDRESS.ConstVal))
             {
                 string hostName = System.Text.ASCIIEncoding.ASCII.GetString(
                     taggedComponent.component_data,
                     8,
                     BitConverter.ToInt32(taggedComponent.component_data, 4) - 1);
                 ushort port = BitConverter.ToUInt16(taggedComponent.component_data,
                                                     taggedComponent.component_data.Length - 2);
                 hostNames.Add(hostName);
                 ports.Add(port);
                 Debug.WriteLine(string.Format("CreateTransport(): host {0}:{1} from IOR added to list", hostName, port));
             }
             result = new TcpClientTransport((string[])hostNames.ToArray(ReflectionHelper.StringType),
                                             (int[])ports.ToArray(ReflectionHelper.Int32Type));
         }
         else
         {
             result = new TcpClientTransport(asIpAddress, iiopProf.Port);
         }
         result.ReceiveTimeOut = m_receiveTimeOut;
         result.SendTimeOut    = m_sendTimeOut;
         return(result);
     }
     else
     {
         throw new INTERNAL(3001, CompletionStatus.Completed_No);
     }
 }
 /// <summary><see cref="Ch.Elca.Iiop.IClientTransportFactory.CreateTransport(IIorProfile)"/></summary>
 public IClientTransport CreateTransport(IIorProfile targetProfile) {
     if (targetProfile.ProfileId == TAG_INTERNET_IOP.ConstVal) {
         IInternetIiopProfile iiopProf = (IInternetIiopProfile)targetProfile;
         IPAddress asIpAddress = ConvertToIpAddress(iiopProf.HostName);
         IClientTransport result;
         if (asIpAddress == null) {
             ArrayList hostNames = new ArrayList();
             ArrayList ports = new ArrayList();
             hostNames.Add(iiopProf.HostName);
             ports.Add(iiopProf.Port);
             foreach (TaggedComponent taggedComponent in 
                      iiopProf.TaggedComponents.GetComponents(ALTERNATE_IIOP_ADDRESS.ConstVal)) {
                 string hostName = System.Text.ASCIIEncoding.ASCII.GetString(
                     taggedComponent.component_data,
                     8,
                     BitConverter.ToInt32(taggedComponent.component_data, 4) - 1);
                 ushort port = BitConverter.ToUInt16(taggedComponent.component_data, 
                                                     taggedComponent.component_data.Length - 2);
                 hostNames.Add(hostName);
                 ports.Add(port);
                 Debug.WriteLine(string.Format("CreateTransport(): host {0}:{1} from IOR added to list", hostName, port));
             }                    
             result = new TcpClientTransport((string[])hostNames.ToArray(ReflectionHelper.StringType),
                                             (int[])ports.ToArray(ReflectionHelper.Int32Type));
         } else {
             result = new TcpClientTransport(asIpAddress, iiopProf.Port);
         }
         result.ReceiveTimeOut = m_receiveTimeOut;
         result.SendTimeOut = m_sendTimeOut;
         return result;
     } else {
         throw new INTERNAL(3001, CompletionStatus.Completed_No);
     }
 }