public TrinketDtpServerImpl(IStreamFactory streamFactory, BootstrapConfigurationGenerator bootstrapConfigurationGenerator, IDtpNode transportNode, TrinketStartupConfiguration startupConfiguration)
 {
     this.streamFactory = streamFactory;
      this.bootstrapConfigurationGenerator = bootstrapConfigurationGenerator;
      this.transportNode = transportNode;
      this.startupConfiguration = startupConfiguration;
 }
        public DtpNodeIT()
        {
            IDtpNodeFactory dtpNodeFactory = new DefaultDtpNodeFactory();

            m_daemonNode = dtpNodeFactory.CreateNode(NodeRole.Server, pipeName);
            m_dimNode    = dtpNodeFactory.CreateNode(NodeRole.Client);
        }
 public IDtpNode CreateNode(NodeRole role, int port = -1, IEnumerable <IInstructionSet> instructionSets = null)
 {
     instructionSets = instructionSets == null ? kNoInstructionSets : instructionSets.ToArray();
     if (role == NodeRole.ServerOrClient)
     {
         IDtpNode result = null;
         while (result == null)
         {
             try {
                 result = CreateNode(NodeRole.Server, port, instructionSets);
             } catch {
                 try {
                     result = CreateNode(NodeRole.Client, -1, instructionSets).With(n => { n.Connect(port); });
                 } catch {
                     // gotta catch em all
                 }
             }
         }
         return(result);
     }
     else if (role == NodeRole.Client)
     {
         if (port != -1)
         {
             throw new InvalidOperationException("Use node.Connect, not CreateNode constructor to connect to server!");
         }
         return(new DtpNode(new NullClientSource(), instructionSets));
     }
     else
     {
         return(new DtpNode(new SocketClientSource(port), instructionSets));
     }
 }
示例#4
0
 public TrinketDtpServerImpl(IStreamFactory streamFactory, BootstrapConfigurationGenerator bootstrapConfigurationGenerator, IDtpNode transportNode, TrinketStartupConfiguration startupConfiguration)
 {
     this.streamFactory = streamFactory;
     this.bootstrapConfigurationGenerator = bootstrapConfigurationGenerator;
     this.transportNode        = transportNode;
     this.startupConfiguration = startupConfiguration;
 }