Ejemplo n.º 1
0
 public DirectSocketClient(HybridConnectionInitiator hybridConnectionInitiator, DirectSocketInitiator directSocketInitiator, Uri uri, TimeSpan timeout)
 {
     this.hybridConnectionInitiator = hybridConnectionInitiator;
     this.directSocketInitiator     = directSocketInitiator;
     this.uri     = uri;
     this.timeout = new TimeoutHelper(timeout);
     this.mutex   = new object();
 }
Ejemplo n.º 2
0
        public HybridConnectionInitiator(BindingContext context, TcpRelayTransportBindingElement transportBindingElement, int bufferSize, TokenProvider tokenProvider, RelayTransportProtectionMode transportProtection)
        {
            this.bufferSize = bufferSize;
            NameSettings nameSetting = new NameSettings();

            nameSetting.ServiceSettings.TransportProtection = transportProtection;
            nameSetting.ServiceSettings.ListenerType        = ListenerType.HybridConnection;
            IConnectionElement relayedSocketElement = new RelayedSocketElement(context, nameSetting, tokenProvider, SocketSecurityRole.None);

            this.relayedSocketInitiator = (new DemuxSocketElement(relayedSocketElement, "relayed")).CreateInitiator(bufferSize);
            IConnectionElement demuxSocketElement = new DemuxSocketElement(relayedSocketElement, "direct");
            Binding            binding            = HybridConnectionElement.CreateDirectControlBindingElement(context, transportBindingElement, demuxSocketElement);

            this.directSocketInitiator = new DirectSocketInitiator(bufferSize, binding);
            this.connectionId          = Guid.NewGuid();
        }