Author: kostat
Date: 2006-12-03 12:09:44 -0500 (Sun, 03 Dec 2006)
New Revision: 68906
Modified:
trunk/mcs/class/System/System.Net.Sockets/Socket.jvm.cs
Log:
adding 2.0 configuration support
Modified: trunk/mcs/class/System/System.Net.Sockets/Socket.jvm.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Sockets/Socket.jvm.cs 2006-12-03
17:09:35 UTC (rev 68905)
+++ trunk/mcs/class/System/System.Net.Sockets/Socket.jvm.cs 2006-12-03
17:09:44 UTC (rev 68906)
@@ -39,6 +39,7 @@
using System.Threading;
using System.Reflection;
using System.IO;
+using System.Net.Configuration;
namespace System.Net.Sockets
{
@@ -977,11 +978,17 @@
if(ipv6Supported == -1)
{
- NetConfig config =
(NetConfig)System.Configuration.ConfigurationSettings.GetConfig("system.net/settings");
-
- if(config != null)
- ipv6Supported = config.ipv6Enabled?-1:0;
-
+#if NET_2_0 && CONFIGURATION_DEP
+ SettingsSection config;
+ config = (SettingsSection)
System.Configuration.ConfigurationManager.GetSection ("system.net/settings");
+ if (config != null)
+ ipv6Supported = config.Ipv6.Enabled ?
-1 : 0;
+#else
+ NetConfig config =
(NetConfig)System.Configuration.ConfigurationSettings.GetConfig("system.net/settings");
+
+ if(config != null)
+ ipv6Supported = config.ipv6Enabled?-1:0;
+#endif
if(ipv6Supported != 0)
{
try
@@ -2147,6 +2154,18 @@
throw new SocketException (error);
}
+#if NET_2_0
+ public void SetSocketOption (SocketOptionLevel level,
SocketOptionName name, bool optionValue) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType
().ToString ());
+
+ int error;
+ int int_val = (optionValue) ? 1 : 0;
+ SetSocketOption_internal (socket, level, name, null,
null, int_val, out error);
+ if (error != 0)
+ throw new SocketException (error);
+ }
+#endif
#if !TARGET_JVM
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static void Shutdown_internal(IntPtr socket,
SocketShutdown how, out int error);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches