Changeset 13556 for branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs
- Timestamp:
- 01/19/16 12:00:45 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.