Index: /branches/thasling/DistributedGA/DistributedGA.Core.Host/App.config
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Core.Host/App.config	(revision 13540)
+++ /branches/thasling/DistributedGA/DistributedGA.Core.Host/App.config	(revision 13541)
@@ -6,4 +6,5 @@
   <appSettings>
     <add key="ContactServerURL" value="http://localhost:9090/DistributedGA.ContactServer/ContactService"/>
+    <add key="LanIpPrefix" value="10."/>
   </appSettings>
 </configuration>
Index: /branches/thasling/DistributedGA/DistributedGA.Core.Host/DistributedGA.Core.Host.csproj
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Core.Host/DistributedGA.Core.Host.csproj	(revision 13540)
+++ /branches/thasling/DistributedGA/DistributedGA.Core.Host/DistributedGA.Core.Host.csproj	(revision 13541)
@@ -46,5 +46,7 @@
   </ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
+    <None Include="App.config">
+      <SubType>Designer</SubType>
+    </None>
   </ItemGroup>
   <ItemGroup>
Index: /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs	(revision 13540)
+++ /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs	(revision 13541)
@@ -2,6 +2,7 @@
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
 using System.Net;
-using System.Text.RegularExpressions;
 using DistributedGA.Core.Domain;
 using DistributedGA.Core.Interface;
@@ -20,10 +21,13 @@
     //provides current population for the higher layer IMigrationOperator
     //to queues are used to gather and and provide population more efficiently
-    private ConcurrentQueue<SolutionInfo> collectedResults1;
-    private ConcurrentQueue<SolutionInfo> collectedResults2;
+    private object activeQueueLocker = new object();
+    private ConcurrentQueue<SolutionInfo> writeQueue;
+    private ConcurrentQueue<SolutionInfo> readQueue;
     private bool collectingInFirstQueue = true; //currently first queue is filled with recieved populations
 
     //uses IMessageService for recieving population from one peer at once
     private IMessageService host = null;
+
+
 
     public void Init() {
@@ -35,6 +39,6 @@
         }; // TODO: get own peerinfo
 
-        collectedResults1 = new ConcurrentQueue<SolutionInfo>();
-        collectedResults2 = new ConcurrentQueue<SolutionInfo>();
+        writeQueue = new ConcurrentQueue<SolutionInfo>();
+        readQueue = new ConcurrentQueue<SolutionInfo>();
 
         host = new WcfMessageService();
@@ -82,16 +86,14 @@
       try {
         List<SolutionInfo> res = new List<SolutionInfo>();
-        ConcurrentQueue<SolutionInfo> source = null;
         SolutionInfo item = null;
-        if (collectingInFirstQueue) {
-          collectingInFirstQueue = false; //switching queue
-          source = collectedResults1;
-        } else {
-          collectingInFirstQueue = true; //switching queue
-          source = collectedResults2;
+        lock (activeQueueLocker) {
+          var tmp = readQueue;
+          readQueue = writeQueue;
+          writeQueue = tmp;
         }
+
         //creating resultset
-        while (!source.IsEmpty) {
-          if (source.TryDequeue(out item)) {
+        while (!readQueue.IsEmpty) {
+          if (readQueue.TryDequeue(out item)) {
             res.Add(item);
           }
@@ -114,9 +116,12 @@
     private string GetExternalIpAddress() {
       try {
-        string externalIP;
-        externalIP = (new WebClient()).DownloadString("http://checkip.dyndns.org/");
-        externalIP = (new Regex(@"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"))
-                     .Matches(externalIP)[0].ToString();
-        return externalIP;
+        var strHostName = Dns.GetHostName();
+        // Then using host name, get the IP address list..
+        IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
+        IPAddress[] addr = ipEntry.AddressList;
+
+        return addr
+          .Select(ip => ip.ToString())
+          .First(str => str.StartsWith(ConfigurationManager.AppSettings["LanIpPrefix"]));
       } catch { return null; }
     }
@@ -124,9 +129,7 @@
     private void OnPopulationRecieved(object sender, MessageRecieveEventArgs e) {
       if (e != null) {
-        foreach (SolutionInfo si in e.Population) {
-          if (collectingInFirstQueue) {
-            collectedResults1.Enqueue(si);
-          } else {
-            collectedResults2.Enqueue(si);
+        lock (activeQueueLocker) {
+          foreach (SolutionInfo si in e.Population) {
+            writeQueue.Enqueue(si);
           }
         }
@@ -141,5 +144,4 @@
       }
     }
-
   }
 }
Index: /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageService.cs
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageService.cs	(revision 13540)
+++ /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageService.cs	(revision 13541)
@@ -17,5 +17,4 @@
     public int Init(string ip) {
       int port = 0;
-      //port = GetRanodmFreePort();
       port = FreeTcpPort();
 
Index: /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs	(revision 13540)
+++ /branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs	(revision 13541)
@@ -9,5 +9,5 @@
 namespace DistributedGA.Core.Implementation {
   public class WcfPeerListManager : IPeerListManager {
-    private string SERVER_STRING = null;
+    private string serverString = null;
 
     private IContactService client = null;
@@ -19,5 +19,5 @@
 
     public void Init(PeerInfo source) {
-      SERVER_STRING = ConfigurationManager.AppSettings["ContactServerURL"];
+      serverString = ConfigurationManager.AppSettings["ContactServerURL"];
       client = CreateClient();
       myself = source;
@@ -41,5 +41,5 @@
     private IContactService CreateClient() {
       var binding = new BasicHttpBinding();
-      var endpoint = new EndpointAddress(SERVER_STRING);
+      var endpoint = new EndpointAddress(serverString);
       var myChannelFactory = new ChannelFactory<IContactService>(binding, endpoint);
 
@@ -52,7 +52,7 @@
       //communicate with 10% of the network
       int noOfPeers = allPeers.Count / 10;
-      List<Int32> indexList = GetRandomItemIndexes(noOfPeers, 0, allPeers.Count - 1);
+      List<int> indexList = GetRandomItemIndexes(noOfPeers, 0, allPeers.Count - 1);
       List<PeerInfo> res = new List<PeerInfo>();
-      foreach (Int32 index in indexList) {
+      foreach (int index in indexList) {
         res.Add(allPeers.ElementAt(index));
       }
@@ -60,6 +60,6 @@
     }
 
-    private List<Int32> GetRandomItemIndexes(int noOfItems, int minValue, int maxValue) {
-      List<Int32> res = new List<Int32>();
+    private List<int> GetRandomItemIndexes(int noOfItems, int minValue, int maxValue) {
+      List<int> res = new List<int>();
       Random rnd = new Random();
       int tmp = -1;
Index: /branches/thasling/DistributedGA/DistributedGA.Hive/App.config
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Hive/App.config	(revision 13541)
+++ /branches/thasling/DistributedGA/DistributedGA.Hive/App.config	(revision 13541)
@@ -0,0 +1,6 @@
+﻿<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+    </startup>
+</configuration>
Index: /branches/thasling/DistributedGA/DistributedGA.Hive/DistributedGA.Hive.csproj
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Hive/DistributedGA.Hive.csproj	(revision 13541)
+++ /branches/thasling/DistributedGA/DistributedGA.Hive/DistributedGA.Hive.csproj	(revision 13541)
@@ -0,0 +1,58 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>438db8b9-d48c-46db-bc5f-af2d60313028</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>DistributedGA.Hive</RootNamespace>
+    <AssemblyName>DistributedGA.Hive</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: /branches/thasling/DistributedGA/DistributedGA.Hive/Program.cs
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Hive/Program.cs	(revision 13541)
+++ /branches/thasling/DistributedGA/DistributedGA.Hive/Program.cs	(revision 13541)
@@ -0,0 +1,30 @@
+﻿
+using System;
+using System.ServiceModel;
+using HeuristicLab.Clients.Hive;
+namespace DistributedGA.Hive {
+  class Program {
+    const string HIVESERVICEURI = @"http://services.heuristiclab.com/Hive-3.3/HiveService.svc";
+
+    static void Main(string[] args) {
+      var client = CreateHiveClient();
+      var myJob = CreateJob();
+      client.AddJob(myJob);
+    }
+
+    private static IHiveService CreateHiveClient() {
+      var binding = new WSHttpBinding();
+      var endpoint = new EndpointAddress(HIVESERVICEURI);
+      var myChannelFactory = new ChannelFactory<IHiveService>(binding, endpoint);
+
+      IHiveService client = null;
+      client = myChannelFactory.CreateChannel();
+      return client;
+    }
+
+    private static Job CreateJob() {
+      throw new NotImplementedException();
+    }
+  }
+
+}
Index: /branches/thasling/DistributedGA/DistributedGA.Hive/Properties/AssemblyInfo.cs
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Hive/Properties/AssemblyInfo.cs	(revision 13541)
+++ /branches/thasling/DistributedGA/DistributedGA.Hive/Properties/AssemblyInfo.cs	(revision 13541)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("DistributedGA.Hive")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DistributedGA.Hive")]
+[assembly: AssemblyCopyright("Copyright ©  2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("438db8b9-d48c-46db-bc5f-af2d60313028")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/thasling/DistributedGA/DistributedGA.Test/DistributedGA.Test.csproj
===================================================================
--- /branches/thasling/DistributedGA/DistributedGA.Test/DistributedGA.Test.csproj	(revision 13540)
+++ /branches/thasling/DistributedGA/DistributedGA.Test/DistributedGA.Test.csproj	(revision 13541)
@@ -76,5 +76,7 @@
   </ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
+    <None Include="App.config">
+      <SubType>Designer</SubType>
+    </None>
   </ItemGroup>
   <ItemGroup>
