Пример #1
0
 /// <summary>
 /// Initializes a new instance of <see cref="DuplexChannel{TRemoteEndPoint}"/> based on the given data.
 /// </summary>
 /// <param name="localEndPointConfig"></param>
 /// <param name="serverChannelProperties"></param>
 internal DuplexChannel(EndPointConfigurationData <TRemoteEndPoint> localEndPointConfig, ChannelProperties serverChannelProperties)
 {
     AssertEndpointConfigurationData(localEndPointConfig, "localEndpointConfig");
     _localEndPointConfig     = localEndPointConfig;
     _localChannelProperties  = serverChannelProperties;
     _remoteChannelProperties = serverChannelProperties.GetRemoteEndpointChannelProperties();
 }
Пример #2
0
 /// <summary>
 /// Asserts the given <see cref="EndPointConfigurationData{TRemoteEndPoint}"/> to be valid.
 /// </summary>
 /// <exception cref="ArgumentException">
 /// And <see cref="ArgumentException"/> is thrown if any of <paramref name="configData"/>'s properties is invalid.
 /// The given <paramref name="paramName"/> is set to <see cref="ArgumentException.ParamName"/>.
 /// </exception>
 /// <param name="configData"></param>
 /// <param name="paramName"></param>
 private static void AssertEndpointConfigurationData(EndPointConfigurationData <TRemoteEndPoint> configData, string paramName)
 {
     if (configData.AllowedClients == null)
     {
         throw new ArgumentException("The given EndPointConfigurationData specifies an illegal value for AllowedClients",
                                     paramName);
     }
 }
Пример #3
0
        /// <summary>
        /// Connects to an existing IPC connection.
        /// </summary>
        /// <remarks>
        /// To set up such a connection, call <see cref="InitializeInterDomainConnection"/> in the remote application domain.
        /// </remarks>
        /// <param name="channelUrl"></param>
        internal void ConnectInterDomainConnection(string channelUrl)
        {
            var endPointConfig = EndPointConfigurationData <DomainConnectionEndPoint> .InitializeDefault();

            var duplexChannel = new DomainChannel(endPointConfig, channelUrl);

            duplexChannel.InitializeConnection(OnDomainConnected);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new IPC connection which has a <see cref="DomainConnectionEndPoint"/> on both connection sides.
        /// </summary>
        /// <remarks>
        /// To connect to the created connection,
        /// call <see cref="ConnectInterDomainConnection"/> in the remote application domain using the returned value.
        /// </remarks>
        /// <returns>The url of the created IPC channel.</returns>
        internal string InitializeInterDomainConnection()
        {
            var endPointConfig = EndPointConfigurationData <DomainConnectionEndPoint> .InitializeDefault();

            var duplexChannel = new DomainChannel(endPointConfig);

            duplexChannel.InitializeConnection(OnDomainConnected);
            return(duplexChannel.LocalEndPointUrl);
        }
Пример #5
0
        /// <summary>
        /// Creates or opens a connection to an instance of <typeparamref name="TEndPoint"/>.
        /// </summary>
        /// <typeparam name="TEndPoint">The type of the endpoint to create or open.</typeparam>
        /// <returns>The url to the endpoint of the connection.</returns>
        internal string CreateChannel <TEndPoint>()
            where TEndPoint : EndPointObject
        {
            var endPointConfig = EndPointConfigurationData <TEndPoint> .InitializeDefault();

            var channel = new SimplexChannel <TEndPoint>(endPointConfig);

            channel.InitializeChannel();
            return(channel.EndPointUrl);
            // ToDo: Testing required, need to save reference to the channel?
        }
Пример #6
0
 /// <summary>
 /// Creates a new full duplex channel, in which the remote endpoint's <see cref="AppDomain"/> is the instantiator.
 /// </summary>
 /// <param name="localEndPointConfig">Configuration for the local endpoint.</param>
 /// <param name="otherChannelUrl">The url to the remote endpoint, which is the channel instantiator.</param>
 public DuplexChannel(EndPointConfigurationData <TRemoteEndPoint> localEndPointConfig, string otherChannelUrl)
     : this(localEndPointConfig, ChannelProperties.InitializeFromUrl(otherChannelUrl).GetRemoteEndpointChannelProperties())
 {
 }
Пример #7
0
 /// <summary>
 /// Creates a new full duplex channel, in which the current <see cref="AppDomain"/> is the instantiator.
 /// </summary>
 /// <param name="localEndPointConfig">Configuration for the local endpoint.</param>
 public DuplexChannel(EndPointConfigurationData <TRemoteEndPoint> localEndPointConfig)
     : this(localEndPointConfig, ChannelProperties.CreateRandomChannelProperties())
 {
 }
Пример #8
0
 /// <summary>
 ///     Initializes a new instance of <see cref="SimplexChannel{TEndPoint}" /> using the given configuration data.
 /// </summary>
 /// <exception cref="ArgumentException"></exception>
 /// <param name="endPointConfigurationData"></param>
 public SimplexChannel(EndPointConfigurationData <TEndPoint> endPointConfigurationData)
 {
     AssertEndpointConfigurationData(endPointConfigurationData, "endPointConfigurationData");
     _channelProperties = ChannelProperties.CreateRandomChannelProperties();
     _endPointConfig    = endPointConfigurationData;
 }