[Mono-bugs] [Bug 38185][Nor] New - Problem setting the ReceiveTimeout option of a Socket

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Mon, 17 Feb 2003 06:20:41 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by carlosga@telefonica.net.

http://bugzilla.ximian.com/show_bug.cgi?id=38185

--- shadow/38185	Mon Feb 17 06:20:41 2003
+++ shadow/38185.tmp.8940	Mon Feb 17 06:20:41 2003
@@ -0,0 +1,88 @@
+Bug#: 38185
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: Red Hat 8
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: carlosga@telefonica.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Problem setting the ReceiveTimeout option of a Socket
+
+Hello:
+
+
+I'm getting the next exception when i try to set the ReceiveTimeout option
+of a Socket:
+
+
+Unhandled Exception: System.Net.Sockets.SocketException: Invalid
+argumentsin (unmanaged) mono(mono_raise_exception+0x20) [0x80bfc70]
+in (unmanaged)
+mono(ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal+0x28b)
+[0x80d99f3]
+in <0x0011e> 00 SocketTest.Test:Main (string[])
+
+
+Here is the test case, it works well under Windows with MS .Net but not
+using mono in Linux:
+
+
+
+using System;
+
+using System.Net;
+
+using System.Net.Sockets;
+
+
+
+
+
+namespace SocketTest
+
+{
+
+	public class Test
+
+	{
+
+		public static void Main(string[] args)
+
+		{
+			IPAddress	hostadd = Dns.Resolve("messenger.hotmail.com").AddressList[0];
+
+			IPEndPoint	remoteEP = new IPEndPoint(hostadd, 1863);
+
+
+			Socket socket = new Socket(AddressFamily.InterNetwork,
+				SocketType.Stream,
+				ProtocolType.Tcp);
+
+			socket.Connect(remoteEP);
+
+		
+Console.WriteLine(socket.GetSocketOption(SocketOptionLevel.Socket,SocketOptionName.ReceiveTimeout));
+
+			socket.SetSocketOption(SocketOptionLevel.Socket, 
+				SocketOptionName.ReceiveTimeout, 4102);
+
+		
+Console.WriteLine(socket.GetSocketOption(SocketOptionLevel.Socket,SocketOptionName.ReceiveTimeout));
+		
+			socket.Close();
+
+			Console.ReadLine();
+
+		}
+
+	}
+
+}