Beispiel #1
0
		public NodeServerTester(Network network = null)
		{
			int retry = 0;
			network = network ?? Network.TestNet;
			while(true)
			{
				try
				{
					var a = _Rand.Next(4000, 60000);
					var b = _Rand.Next(4000, 60000);
					_Server1 = new NodeServer(network, internalPort: a);
					_Server1.AllowLocalPeers = true;
					_Server1.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6Ex(), a);
					_Server1.Listen();
					_Server2 = new NodeServer(network, internalPort: b);
					_Server2.AllowLocalPeers = true;
					_Server2.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6Ex(), b);
					_Server2.Listen();
					break;
				}
				catch(Exception)
				{
					if(_Server1 != null)
						_Server1.Dispose();
					if(_Server2 != null)
						_Server2.Dispose();
					retry++;
					if(retry == 5)
						throw;
				}
			}
		}
Beispiel #2
0
 public NodeServerTester()
 {
     _Server1 = new NodeServer(Network.Main, internalPort: 3390);
     _Server1.AllowLocalPeers = true;
     _Server1.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6(), 3390);
     _Server1.NATRuleName = NATRuleName;
     _Server1.Listen();
     _Server2 = new NodeServer(Network.Main, internalPort: 3391);
     _Server2.AllowLocalPeers = true;
     _Server2.NATRuleName = NATRuleName;
     _Server2.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6(), 3391);
     _Server2.Listen();
 }
Beispiel #3
0
		public NodeServerTester(Network network = null)
		{
			network = network ?? Network.TestNet;
			var a = _Rand.Next(4000, 60000);
			var b = _Rand.Next(4000, 60000);
			_Server1 = new NodeServer(network, internalPort: a);
			_Server1.AllowLocalPeers = true;
			_Server1.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6(), a);
			_Server1.Listen();
			_Server2 = new NodeServer(network, internalPort: b);
			_Server2.AllowLocalPeers = true;
			_Server2.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6(), b);
			_Server2.Listen();
		}
 internal MiniNode CreateLocalNode()
 {
     NodeServer nodeServer = new NodeServer(Client.Configuration.Network, internalPort: (ushort)RandomUtils.GetInt32());
     nodeServer.Listen();
     _NodeServer = nodeServer;
     Indexer.Configuration.Node = "127.0.0.1:" + nodeServer.LocalEndpoint.Port;
     return new MiniNode(this, nodeServer);
 }