Changeset 13556 for branches/thasling/DistributedGA/DistributedGA.Core
- Timestamp:
- 01/19/16 12:00:45 (9 years ago)
- Location:
- branches/thasling/DistributedGA/DistributedGA.Core
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/thasling/DistributedGA/DistributedGA.Core/DistributedGA.Core.csproj
r13538 r13556 29 29 <ErrorReport>prompt</ErrorReport> 30 30 <WarningLevel>4</WarningLevel> 31 </PropertyGroup> 32 <PropertyGroup> 33 <SignAssembly>true</SignAssembly> 34 </PropertyGroup> 35 <PropertyGroup> 36 <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile> 31 37 </PropertyGroup> 32 38 <ItemGroup> … … 61 67 <Compile Include="SolutionInfo.cs" /> 62 68 </ItemGroup> 69 <ItemGroup> 70 <None Include="HeuristicLab.snk" /> 71 </ItemGroup> 63 72 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 64 73 <!-- 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 2 2 using System.Collections.Concurrent; 3 3 using System.Collections.Generic; 4 using System.Configuration;5 4 using System.Linq; 6 5 using System.Net; … … 30 29 31 30 32 public void Init( ) {31 public void Init(string lanIpPrefix, string contactServerUrl) { 33 32 try { 34 33 ownInstance = new PeerInfo() { 35 IpAddress = GetExternalIpAddress( ),34 IpAddress = GetExternalIpAddress(lanIpPrefix), 36 35 Port = 0, 37 36 ProblemInstance = "TestProblem" … … 46 45 47 46 peerListManager = new WcfPeerListManager(); 48 peerListManager.Init(ownInstance );47 peerListManager.Init(ownInstance, contactServerUrl); 49 48 50 49 sender = new WcfMessageSender(); … … 114 113 } 115 114 116 private string GetExternalIpAddress( ) {115 private string GetExternalIpAddress(string ipPrefix) { 117 116 try { 118 117 var strHostName = Dns.GetHostName(); … … 123 122 return addr 124 123 .Select(ip => ip.ToString()) 125 .First(str => str.StartsWith( ConfigurationManager.AppSettings["LanIpPrefix"]));124 .First(str => str.StartsWith(ipPrefix)); 126 125 } catch { return null; } 127 126 } -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/TestPeerListManager.cs
r13524 r13556 1 using DistributedGA.Core.Domain; 1 using System.Collections.Generic; 2 using DistributedGA.Core.Domain; 2 3 using 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;9 4 10 namespace DistributedGA.Core.Implementation 11 { 12 public class TestPeerListManager : IPeerListManager 13 { 14 public void Init(PeerInfo source) 15 { 5 namespace DistributedGA.Core.Implementation { 6 public class TestPeerListManager : IPeerListManager { 16 7 17 }18 8 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 } 28 17 29 public void SendLogToServer(string msg) 30 { 18 public void SendLogToServer(string msg) { 31 19 32 }33 20 } 21 22 public void Init(PeerInfo source, string contactServerUrl) { 23 24 } 25 } 34 26 } -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs
r13554 r13556 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Configuration;4 3 using System.Linq; 5 4 using System.ServiceModel; … … 15 14 private PeerInfo myself = null; 16 15 17 public void Init(PeerInfo source ) {18 serverString = ConfigurationManager.AppSettings["ContactServerURL"];16 public void Init(PeerInfo source, string contactServerUrl) { 17 serverString = contactServerUrl; 19 18 client = CreateClient(); 20 19 myself = source; -
branches/thasling/DistributedGA/DistributedGA.Core/Interface/IMessageHandler.cs
r13553 r13556 4 4 namespace DistributedGA.Core.Interface { 5 5 public interface IMessageHandler { 6 void Init( ); //Registers at contract-server6 void Init(string lanIpPrefix, string contactServerUrl); //Registers at contract-server 7 7 8 8 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; 1 using System.Collections.Generic; 2 using DistributedGA.Core.Domain; 7 3 8 namespace DistributedGA.Core.Interface 9 { 10 public interface IPeerListManager 11 { 12 void Init(PeerInfo source); //Registers own instance at the contact-server 4 namespace DistributedGA.Core.Interface { 5 public interface IPeerListManager { 6 void Init(PeerInfo source, string contactServerUrl); //Registers own instance at the contact-server 13 7 14 8 List<PeerInfo> GetPeerList(); //Recieves all peers in the network from contact-server 15 9 16 17 10 void SendLogToServer(string msg); 11 } 18 12 }
Note: See TracChangeset
for help on using the changeset viewer.