Mercurial > hg > Database > Christie-sharp
changeset 67:806965e04299
add Toppology Code
author | KaitoMaeshiro <aosskaito@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 30 Jan 2022 16:06:33 +0900 |
parents | 312de6b900bc |
children | 976d43003487 |
files | Christie_net.csproj Test/Topology/TreeTestTopology/ChildCodeGear.cs Test/Topology/TreeTestTopology/StartTreeTestTopology.cs topology/HostMessage.cs topology/node/TopologyNode.cs topology/node/TopologyNodeConfig.cs |
diffstat | 6 files changed, 34 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Christie_net.csproj Sun Jan 30 01:48:43 2022 +0900 +++ b/Christie_net.csproj Sun Jan 30 16:06:33 2022 +0900 @@ -3,7 +3,7 @@ <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp6.0</TargetFramework> - <StartupObject>Christie_net.Test.Example.FizzBuzz.StartFizzBuzz</StartupObject> + <StartupObject>Christie_net.Test.Topology.TreeTestTopology.StartTreeTestTopology</StartupObject> </PropertyGroup> <ItemGroup>
--- a/Test/Topology/TreeTestTopology/ChildCodeGear.cs Sun Jan 30 01:48:43 2022 +0900 +++ b/Test/Topology/TreeTestTopology/ChildCodeGear.cs Sun Jan 30 16:06:33 2022 +0900 @@ -13,6 +13,7 @@ public override void Run(CodeGearManager cgm) { + Console.WriteLine("a"); List<String> _CLIST = topoDG.getConnectionList(); if(_CLIST.Contains("parent")) { GetDgm("parent").Put("childNodeName", topoDG.getNodeName());
--- a/Test/Topology/TreeTestTopology/StartTreeTestTopology.cs Sun Jan 30 01:48:43 2022 +0900 +++ b/Test/Topology/TreeTestTopology/StartTreeTestTopology.cs Sun Jan 30 16:06:33 2022 +0900 @@ -1,4 +1,5 @@ using System; +using System.Net; using Christie_net.codegear; using Christie_net.topology.manager; using Christie_net.topology.node; @@ -15,6 +16,18 @@ int topologyManagerPort = 10000; int topologyNodePort = 10001; int nodeNum = 3; + + string ipaddress = ""; + IPHostEntry ipentry = Dns.GetHostEntry(Dns.GetHostName()); + + foreach (IPAddress ip in ipentry.AddressList) + { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + Console.WriteLine(ip.ToString()); + } + } + String[] managerArg = {"--localPort", topologyManagerPort.ToString(), "--Topology", "tree"}; TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(managerArg); new StartTopologyManager(topologyManagerConfig);
--- a/topology/HostMessage.cs Sun Jan 30 01:48:43 2022 +0900 +++ b/topology/HostMessage.cs Sun Jan 30 16:06:33 2022 +0900 @@ -18,8 +18,22 @@ public void setLocalHostAndPort(int port){ + /* //localhostからIPアドレスを取得 hostName = IPAddress.Loopback.ToString(); + */ + + string ipaddress = ""; + IPHostEntry ipentry = Dns.GetHostEntry(Dns.GetHostName()); + + foreach (IPAddress ip in ipentry.AddressList) + { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + hostName = ip.ToString(); + } + } + this.port = port; } @@ -78,5 +92,6 @@ return cloneHostMessage; } */ + } } \ No newline at end of file
--- a/topology/node/TopologyNode.cs Sun Jan 30 01:48:43 2022 +0900 +++ b/topology/node/TopologyNode.cs Sun Jan 30 16:06:33 2022 +0900 @@ -13,9 +13,7 @@ public override void Run(CodeGearManager cgm) { - cgm.CreateRemoteDGM(topologyNodeConfig.getManagerKey(), - topologyNodeConfig.getManagerHostName(), - topologyNodeConfig.getManagerPort()); + cgm.CreateRemoteDGM(topologyNodeConfig.getManagerKey(), topologyNodeConfig.getManagerHostName(), topologyNodeConfig.getManagerPort()); HostMessage hostMessage = new HostMessage(); hostMessage.setLocalHostAndPort(cgm.localPort); @@ -23,6 +21,7 @@ GetDgm(topologyNodeConfig.getManagerKey()).Put("hostMessage", hostMessage); + cgm.Setup(new IncomingConnectionInfo()); cgm.Setup(new ConfigurationFinish());
--- a/topology/node/TopologyNodeConfig.cs Sun Jan 30 01:48:43 2022 +0900 +++ b/topology/node/TopologyNodeConfig.cs Sun Jan 30 16:06:33 2022 +0900 @@ -50,11 +50,11 @@ } public void setLocalKey(String local) { - this.localKey = local; + localKey = local; } public void setManagerKey(String manager) { - this.managerKey = manager; + managerKey = manager; } public String getManagerKey() {