Changeset 1287 for trunk/sources/HeuristicLab.CEDMA.Server/Server.cs
- Timestamp:
- 03/08/09 12:48:18 (15 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Server/Server.cs
r1044 r1287 51 51 52 52 public Server(IStore store) { 53 // windows XP returns the external ip on index 0 while windows vista returns the external ip on index 2 53 IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName()); 54 // windows XP returns the external ip on index 0 while windows vista returns the external ip as one of the last entries 55 // also if IPv6 protocol is installed we want to find an entry that is IPv4 56 int index = 0; 54 57 if (System.Environment.OSVersion.Version.Major >= 6) { 55 cedmaServiceUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[2] + ":8002/CEDMA/World";56 } else {57 cedmaServiceUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8002/CEDMA/World";58 for (index = addresses.Length - 1; index >= 0; index--) 59 if (addresses[index].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) 60 break; 58 61 } 62 cedmaServiceUrl = "net.tcp://" + addresses[index] + ":8002/CEDMA"; 59 63 this.store = store; 60 64 } … … 67 71 try { 68 72 NetTcpBinding binding = new NetTcpBinding(); 69 binding.MaxReceivedMessageSize = 100000000; // 100Mbytes 70 binding.ReaderQuotas.MaxStringContentLength = 100000000; // also 100M chars 71 binding.ReaderQuotas.MaxArrayLength = 100000000; // also 100M elements; 72 binding.Security.Mode = SecurityMode.None; 73 73 binding.SendTimeout = new TimeSpan(1, 0, 0); 74 binding.MaxReceivedMessageSize = 1000000000; // 100Mbytes 75 binding.ReaderQuotas.MaxStringContentLength = 1000000000; // also 100M chars 76 binding.ReaderQuotas.MaxArrayLength = 1000000000; // also 100M elements; 74 77 host.AddServiceEndpoint(typeof(IStore), binding, cedmaServiceUrl); 75 78 host.Open();
Note: See TracChangeset
for help on using the changeset viewer.