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

new hive project

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.