Bug 3599 - SetSocketOption throws exception Value does not fall within expected range
Summary: SetSocketOption throws exception Value does not fall within expected range
Status: RESOLVED DOWNSTREAM
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-02-22 15:16 UTC by cmre99
Modified: 2012-02-26 05:55 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DOWNSTREAM

Description cmre99 2012-02-22 15:16:03 UTC
On Windows Server 2003 using MonoDevelop 2.8.6.5 and Mono 2.6.7
MonoDevelop configured to use Mono 2.6.7 Runtime ( not .Net runtime )

The code:

	IPAddress ipAddress = IPAddress.Parse ("239.255.255.250");
			
	EndPoint endPoint = new IPEndPoint (IPAddress.Parse("239.255.255.250"), 1900);

	Socket notifySocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
	
	notifySocket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption (ipAddress));


This code runs fine on OS-X using Mono but on Windows the SetSocketOption call generates an exception stating "Value does not fall within expected range".  Is this a bug? Is there a work-around?  How can I get this to run on both Windows and OS-X?
Comment 1 cmre99 2012-02-22 16:24:49 UTC
Tested on Windows using Mono 2.10.8 runtime with same results.
Comment 2 cmre99 2012-02-26 05:55:44 UTC
WIndows sockets require different settings from "unix" sockets.  The codebase must make platform specific adjustments.