예제 #1
0
        static void Main(string[] args)
        {
            var conf = RapidBaseConfiguration.FromConfiguration();

            conf.EnsureSetup();
            RapidBaseListener listener = new RapidBaseListener(conf);

            listener.Listen();
            listener.Wait();
        }
예제 #2
0
        public ListenerTester(ServerTester tester)
        {
            _Network = tester.Configuration.Indexer.Network;
            Random rand = new Random();

            _Server = tester;
            _Server._disposables.Add(this);
            _Listener = new RapidBaseListener(_Server.Configuration);

            _NodeServer   = new NodeServer(_Server.Configuration.Indexer.Network, internalPort: rand.Next(20000, 50000));
            _NodeListener = new EventLoopMessageListener <IncomingMessage>(NewNodeMessage);
            _NodeServer.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), _NodeServer.LocalEndpoint.Port);
            _NodeServer.AllowLocalPeers  = true;
            _NodeServer.IsRelay          = true;
            _NodeServer.AllMessages.AddMessageListener(_NodeListener);
            _NodeServer.Listen();

            _Listener.Configuration.Indexer.Node = "127.0.0.1:" + _NodeServer.LocalEndpoint.Port;
            _Listener.Listen();

            _Server.ChainBuilder.SkipIndexer     = true;
            _Server.ChainBuilder.NewBlock       += ChainBuilder_NewBlock;
            _Server.ChainBuilder.NewTransaction += ChainBuilder_NewTransaction;
        }