private int GetFreePort(NetSettings netSettings) { int defaultPort = 8123; try { // TCP stack please do me a favor TcpListener l = new TcpListener(IPAddress.Parse(netSettings.Socks5ListeningAddress), 0); l.Start(); var port = ((IPEndPoint)l.LocalEndpoint).Port; l.Stop(); return(port); } catch (Exception e) { // in case access denied this.Log().Error(e, ""); return(defaultPort); } }
public ApplicationSettings() { Queue = new QueueSettings(this); BitTorrent = new BitTorrentSettings(this); DiskIO = new DiskIOSettings(this); Seed = new SeedSettings(this); Peer = new PeerSettings(this); Net = new NetSettings(this); Statistics = new StatsSettings(this); Gui = new GuiSettings(this); Isp = new IspSettings(this); Scheduling = new SchedulingSettings(this); Show = new ShowSettings(this); Webui = new WebuiSettings(this); Streaming = new StreamingSettings(this); Directory = new DirectorySettings(this); Transfer = new MultidayTransferSettings(this); Proxy = new ProxySettings(this); Cache = new CacheSettings(this); }
public NotificationEngine(IHubContext <NodeHub> nodeHub, IHubContext <BlockHub> blockHub, IHubContext <TransactionCountHub> transCountHub, IHubContext <TransactionAverageCountHub> transAvgCountHub, NodeCache nodeCache, NodeSynchronizer nodeSynchronizer, RPCNodeCaller rPCNodeCaller, StateOfNeoContext ctx, IOptions <NetSettings> netSettings) { _ctx = ctx; _nodeHub = nodeHub; _nodeCache = nodeCache; _transCountHub = transCountHub; _transAvgCountHub = transAvgCountHub; _nodeSynchronizer = nodeSynchronizer; _rPCNodeCaller = rPCNodeCaller; _netSettings = netSettings.Value; this.blockHub = blockHub; }
private void ServerState_Click(object sender, EventArgs e) { int State = 0; object Host, NetSettings; IntPtr devHandle = (IntPtr)TreeViewServer.SelectedNode.Tag; u2ec.ServerGetUsbDevStatus(HandleServer, devHandle, out State, out Host); u2ec.ServerGetSharedUsbDevNetSettings(HandleServer, devHandle, out NetSettings); string result = ""; if (State == u2ec.STATE_CONNECTED) { result = "connected / " + NetSettings.ToString() + " / " + Host.ToString(); } else if (State == u2ec.STATE_WAITING) { result = "waiting for connection / " + NetSettings.ToString(); } MessageBox.Show(result); }
public static NetSettings ReadNetSettings(string filename = null) { NetSettings settings = null; try { if (File.Exists(filename ?? netSettingsFileFullPath)) { using (var sr = new StreamReader(filename ?? netSettingsFileFullPath)) { string row = sr.ReadLine(); settings = new NetSettings(row); sr.BaseStream.Close(); sr.Close(); } } return(settings); } catch (Exception) { return(null); } }
public NetSettings[] GetSettings() { if (DocumentAngelNet.Net == null) { return(null); } var settings = new NetSettings[DocumentAngelNet.Net.Layers.Length]; for (var i = 0; i < DocumentAngelNet.Net.Layers.Length; i++) { var layer = DocumentAngelNet.Net.Layers[i]; switch (layer.Type) { case LayerType.Convolution: var convLayer = (IConvolutionLayer)layer; settings[i] = new NetSettings(layer.Type, convLayer.ActivationFunctionType, convLayer.NeuronsCount, convLayer.KernelSize); break; case LayerType.MaxPoolingLayer: var poolLayer = (IMaxPoolingLayer)layer; settings[i] = new NetSettings(layer.Type, ActivationType.None, null, poolLayer.KernelSize); break; case LayerType.FullyConnected: var fullLayer = (IFullyConnectedLayer)layer; settings[i] = new NetSettings(layer.Type, fullLayer.ActivationFunctionType, fullLayer.NeuronsCount, null); break; default: throw new ArgumentException(); } } return(settings); }
public NotificationEngine( IHubContext <NodeHub> nodeHub, IHubContext <BlockHub> blockHub, IHubContext <TransactionCountHub> transCountHub, IHubContext <TransactionAverageCountHub> transAvgCountHub, IHubContext <FailedP2PHub> failP2PHub, NodeCache nodeCache, PeersEngine peersEngine, NodeSynchronizer nodeSynchronizer, RPCNodeCaller rPCNodeCaller, IOptions <NetSettings> netSettings) { this.nodeHub = nodeHub; this.nodeCache = nodeCache; this.transCountHub = transCountHub; this.failP2PHub = failP2PHub; this.transAvgCountHub = transAvgCountHub; this.nodeSynchronizer = nodeSynchronizer; this.rPCNodeCaller = rPCNodeCaller; this.netSettings = netSettings.Value; this.peersEngine = peersEngine; this.blockHub = blockHub; }
public RPCNodeCaller(IOptions <NetSettings> netSettings) { this.netSettings = netSettings.Value; }
public NodeService(StateOfNeoContext db, IOptions <NetSettings> netSettings) : base(db) { this.netSettings = netSettings.Value; }
public LobbyContainer() { InitializeComponent(); NetSettings = new NetSettings(string.Empty, 44544, 44544, string.Empty); }