Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13556


Ignore:
Timestamp:
01/19/16 12:00:45 (8 years ago)
Author:
thasling
Message:

new hive project

Location:
branches/thasling/DistributedGA
Files:
4 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/thasling/DistributedGA/DistributedGA.Core.Host/Program.cs

    r13553 r13556  
    1111        Console.WriteLine("Starting peer...");
    1212        IMessageHandler h = new PeerNetworkMessageHandler();
    13         h.Init();
     13        h.Init("","");
    1414        PeerInfo pi = h.GetPeerInfo();
    1515        Console.WriteLine(string.Format("Peer is hostet at IP: {0} and port: {1}", pi.IpAddress, pi.Port));
  • branches/thasling/DistributedGA/DistributedGA.Core/DistributedGA.Core.csproj

    r13538 r13556  
    2929    <ErrorReport>prompt</ErrorReport>
    3030    <WarningLevel>4</WarningLevel>
     31  </PropertyGroup>
     32  <PropertyGroup>
     33    <SignAssembly>true</SignAssembly>
     34  </PropertyGroup>
     35  <PropertyGroup>
     36    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
    3137  </PropertyGroup>
    3238  <ItemGroup>
     
    6167    <Compile Include="SolutionInfo.cs" />
    6268  </ItemGroup>
     69  <ItemGroup>
     70    <None Include="HeuristicLab.snk" />
     71  </ItemGroup>
    6372  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    6473  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs

    r13554 r13556  
    22using System.Collections.Concurrent;
    33using System.Collections.Generic;
    4 using System.Configuration;
    54using System.Linq;
    65using System.Net;
     
    3029
    3130
    32     public void Init() {
     31    public void Init(string lanIpPrefix, string contactServerUrl) {
    3332      try {
    3433        ownInstance = new PeerInfo() {
    35           IpAddress = GetExternalIpAddress(),
     34          IpAddress = GetExternalIpAddress(lanIpPrefix),
    3635          Port = 0,
    3736          ProblemInstance = "TestProblem"
     
    4645
    4746        peerListManager = new WcfPeerListManager();
    48         peerListManager.Init(ownInstance);
     47        peerListManager.Init(ownInstance, contactServerUrl);
    4948
    5049        sender = new WcfMessageSender();
     
    114113    }
    115114
    116     private string GetExternalIpAddress() {
     115    private string GetExternalIpAddress(string ipPrefix) {
    117116      try {
    118117        var strHostName = Dns.GetHostName();
     
    123122        return addr
    124123          .Select(ip => ip.ToString())
    125           .First(str => str.StartsWith(ConfigurationManager.AppSettings["LanIpPrefix"]));
     124          .First(str => str.StartsWith(ipPrefix));
    126125      } catch { return null; }
    127126    }
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/TestPeerListManager.cs

    r13524 r13556  
    1 using DistributedGA.Core.Domain;
     1using System.Collections.Generic;
     2using DistributedGA.Core.Domain;
    23using DistributedGA.Core.Interface;
    3 using System;
    4 using System.Collections.Generic;
    5 using System.Linq;
    6 using System.ServiceModel;
    7 using System.Text;
    8 using System.Threading.Tasks;
    94
    10 namespace DistributedGA.Core.Implementation
    11 {
    12     public class TestPeerListManager : IPeerListManager
    13     {
    14         public void Init(PeerInfo source)
    15         {
     5namespace DistributedGA.Core.Implementation {
     6  public class TestPeerListManager : IPeerListManager {
    167
    17         }
    188
    19         public List<PeerInfo> GetPeerList()
    20         {
    21             PeerInfo pi1 = new PeerInfo() { IpAddress = "localhost", Port = 3030 };
    22             PeerInfo pi2 = new PeerInfo() { IpAddress = "localhost", Port = 3031 };
    23             PeerInfo pi3 = new PeerInfo() { IpAddress = "localhost", Port = 3032 };
    24             PeerInfo pi4 = new PeerInfo() { IpAddress = "localhost", Port = 3033 };
    25             PeerInfo pi5 = new PeerInfo() { IpAddress = "localhost", Port = 3034 };
    26             return new List<PeerInfo>() { pi1, pi2, pi3, pi4, pi5 };
    27         }
     9    public List<PeerInfo> GetPeerList() {
     10      PeerInfo pi1 = new PeerInfo() { IpAddress = "localhost", Port = 3030 };
     11      PeerInfo pi2 = new PeerInfo() { IpAddress = "localhost", Port = 3031 };
     12      PeerInfo pi3 = new PeerInfo() { IpAddress = "localhost", Port = 3032 };
     13      PeerInfo pi4 = new PeerInfo() { IpAddress = "localhost", Port = 3033 };
     14      PeerInfo pi5 = new PeerInfo() { IpAddress = "localhost", Port = 3034 };
     15      return new List<PeerInfo>() { pi1, pi2, pi3, pi4, pi5 };
     16    }
    2817
    29         public void SendLogToServer(string msg)
    30         {
     18    public void SendLogToServer(string msg) {
    3119
    32         }
    3320    }
     21
     22    public void Init(PeerInfo source, string contactServerUrl) {
     23
     24    }
     25  }
    3426}
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs

    r13554 r13556  
    11using System;
    22using System.Collections.Generic;
    3 using System.Configuration;
    43using System.Linq;
    54using System.ServiceModel;
     
    1514    private PeerInfo myself = null;
    1615
    17     public void Init(PeerInfo source) {
    18       serverString = ConfigurationManager.AppSettings["ContactServerURL"];
     16    public void Init(PeerInfo source, string contactServerUrl) {
     17      serverString = contactServerUrl;
    1918      client = CreateClient();
    2019      myself = source;
  • branches/thasling/DistributedGA/DistributedGA.Core/Interface/IMessageHandler.cs

    r13553 r13556  
    44namespace DistributedGA.Core.Interface {
    55  public interface IMessageHandler {
    6     void Init(); //Registers at contract-server
     6    void Init(string lanIpPrefix, string contactServerUrl); //Registers at contract-server
    77
    88    void PublishDataToNetwork(SolutionInfo[] data);
  • branches/thasling/DistributedGA/DistributedGA.Core/Interface/IPeerListManager.cs

    r13524 r13556  
    1 using DistributedGA.Core.Domain;
    2 using System;
    3 using System.Collections.Generic;
    4 using System.Linq;
    5 using System.Text;
    6 using System.Threading.Tasks;
     1using System.Collections.Generic;
     2using DistributedGA.Core.Domain;
    73
    8 namespace DistributedGA.Core.Interface
    9 {
    10     public interface IPeerListManager
    11     {
    12         void Init(PeerInfo source); //Registers own instance at the contact-server
     4namespace DistributedGA.Core.Interface {
     5  public interface IPeerListManager {
     6    void Init(PeerInfo source, string contactServerUrl); //Registers own instance at the contact-server
    137
    14         List<PeerInfo> GetPeerList(); //Recieves all peers in the network from contact-server
     8    List<PeerInfo> GetPeerList(); //Recieves all peers in the network from contact-server
    159
    16         void SendLogToServer(string msg);
    17     }
     10    void SendLogToServer(string msg);
     11  }
    1812}
  • branches/thasling/DistributedGA/DistributedGA.Hive/DistributedGA.Hive.csproj

    r13545 r13556  
    66    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    77    <ProjectGuid>{F191E644-1AFC-4825-8897-E79A6ED91B20}</ProjectGuid>
    8     <OutputType>Exe</OutputType>
     8    <OutputType>Library</OutputType>
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    1010    <RootNamespace>DistributedGA.Hive</RootNamespace>
     
    3232    <WarningLevel>4</WarningLevel>
    3333  </PropertyGroup>
     34  <PropertyGroup>
     35    <StartupObject />
     36  </PropertyGroup>
     37  <PropertyGroup>
     38    <SignAssembly>true</SignAssembly>
     39  </PropertyGroup>
     40  <PropertyGroup>
     41    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
     42  </PropertyGroup>
    3443  <ItemGroup>
    3544    <Reference Include="HeuristicLab.Clients.Hive-3.3">
    3645      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Clients.Hive-3.3.dll</HintPath>
    3746    </Reference>
    38     <Reference Include="HeuristicLab.Clients.Hive.JobManager-3.3">
    39       <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Clients.Hive.JobManager-3.3.dll</HintPath>
     47    <Reference Include="HeuristicLab.Collections-3.3">
     48      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Collections-3.3.dll</HintPath>
     49    </Reference>
     50    <Reference Include="HeuristicLab.Common-3.3">
     51      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Common-3.3.dll</HintPath>
     52    </Reference>
     53    <Reference Include="HeuristicLab.Core-3.3">
     54      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Core-3.3.dll</HintPath>
     55    </Reference>
     56    <Reference Include="HeuristicLab.Data-3.3">
     57      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Data-3.3.dll</HintPath>
     58    </Reference>
     59    <Reference Include="HeuristicLab.Hive-3.3">
     60      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Hive-3.3.dll</HintPath>
     61    </Reference>
     62    <Reference Include="HeuristicLab.Optimization-3.3">
     63      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Optimization-3.3.dll</HintPath>
     64    </Reference>
     65    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     66      <SpecificVersion>False</SpecificVersion>
     67      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Parameters-3.3.dll</HintPath>
     68    </Reference>
     69    <Reference Include="HeuristicLab.Persistence-3.3">
     70      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.Persistence-3.3.dll</HintPath>
     71    </Reference>
     72    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
     73      <HintPath>..\..\..\..\Users\Lokal\Downloads\HeuristicLab 3.3.13\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    4074    </Reference>
    4175    <Reference Include="System" />
    4276    <Reference Include="System.Core" />
     77    <Reference Include="System.Drawing" />
    4378    <Reference Include="System.ServiceModel" />
    4479    <Reference Include="System.Xml.Linq" />
     
    4984  </ItemGroup>
    5085  <ItemGroup>
    51     <Compile Include="Program.cs" />
     86    <Compile Include="P2PTask.cs" />
     87    <Compile Include="Plugin.cs" />
    5288    <Compile Include="Properties\AssemblyInfo.cs" />
    5389  </ItemGroup>
    5490  <ItemGroup>
    5591    <None Include="App.config" />
     92    <None Include="HeuristicLab.snk" />
     93  </ItemGroup>
     94  <ItemGroup>
     95    <ProjectReference Include="..\DistributedGA.Core\DistributedGA.Core.csproj">
     96      <Project>{02e73f42-bdc9-4a7a-b74f-5879def27320}</Project>
     97      <Name>DistributedGA.Core</Name>
     98    </ProjectReference>
    5699  </ItemGroup>
    57100  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/thasling/DistributedGA/DistributedGA.Test/Form1.cs

    r13553 r13556  
    2626    private void button3_Click(object sender, EventArgs e) {
    2727      IMessageHandler h1 = new PeerNetworkMessageHandler();
    28       h1.Init();
     28      h1.Init("", "");
    2929      IMessageHandler h2 = new PeerNetworkMessageHandler();
    30       h2.Init();
     30      h2.Init("", "");
    3131      IMessageHandler h3 = new PeerNetworkMessageHandler();
    32       h3.Init();
     32      h3.Init("", "");
    3333      IMessageHandler h4 = new PeerNetworkMessageHandler();
    34       h4.Init();
     34      h4.Init("", "");
    3535      IMessageHandler h5 = new PeerNetworkMessageHandler();
    36       h5.Init();
     36      h5.Init("", "");
    3737      var pop1 = CreatePopulation();
    3838      h1.PublishDataToNetwork(pop1);
     
    5353    private void button4_Click(object sender, EventArgs e) {
    5454      var l = new WcfPeerListManager();
    55       l.Init(CreatePeerInfo());
     55      l.Init(CreatePeerInfo(),"");
    5656      l.GetPeerList();
    5757    }
Note: See TracChangeset for help on using the changeset viewer.