[Mono-bugs] [Bug 75306][Cri] New - Socet.Select on Write

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Jun 18 09:44:05 EDT 2005


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 ice-k at amnesty.scene.pl.

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

--- shadow/75306	2005-06-18 09:44:05.000000000 -0400
+++ shadow/75306.tmp.24969	2005-06-18 09:44:05.000000000 -0400
@@ -0,0 +1,124 @@
+Bug#: 75306
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: ice-k at amnesty.scene.pl               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Socet.Select on Write
+
+After update to 1.1.8 (Win32) version Socket.Select does not working on
+Select Write Mode properly
+After Accepted connecion 
+Socket.Select(ConnectionListRead, ConnectionListWrite, null, 100); 
+
+ConnectionListRead has two socket availabe for read 
+ConnectionListWrite has no socket ready for write
+?
+no problem with older version of runtime and core lib
+
+----------------------------- CODE --------------------------------
+using System;
+using System.Collections;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+
+class SocketTest 
+{
+
+	public static int Main() 
+	{
+		IPEndPoint ipEndpoint = new IPEndPoint(IPAddress.Any, 80);
+		Socket ListeningSocket = new  Socket(ipEndpoint.AddressFamily,
+SocketType.Stream, ProtocolType.Tcp);
+
+		ListeningSocket.Blocking = false;
+		ListeningSocket.Bind (ipEndpoint);
+		ListeningSocket.Listen(1000);	
+
+
+		// Pooling
+
+		ArrayList AcceptedClientList = new ArrayList();
+
+		while(true)
+		{
+			Socket Client = null; 
+
+			if ( ListeningSocket.Poll(0, SelectMode.SelectRead) )
+			{
+				try 
+				{
+					Client = ListeningSocket.Accept ();
+					Client.Blocking = false;
+
+					Console.WriteLine("Accpet Connection from: " +
+Client.RemoteEndPoint.ToString());
+					AcceptedClientList.Add(Client);
+
+
+				}
+				catch(Exception ex)
+				{
+					Console.WriteLine("Excpetion: " + ex.Message);
+				}
+
+			}
+		
+		if(AcceptedClientList.Count == 0) continue;
+
+		ArrayList ConnectionListRead   = new ArrayList(AcceptedClientList);
+		ArrayList ConnectionListWrite  = new ArrayList(AcceptedClientList);
+
+		Socket.Select(ConnectionListRead, ConnectionListWrite, null, 100); 
+
+		int i = 0;
+
+		foreach ( Socket sock in ConnectionListRead )
+		{
+			Console.WriteLine("Can Read: " + sock.RemoteEndPoint.ToString() + " i="
++ i++);
+		}
+
+		i = 0;
+		foreach ( Socket sock in ConnectionListWrite )
+		{
+			Console.WriteLine("Can Write: " + sock.RemoteEndPoint.ToString() + " i="
++ i++);
+		}
+
+
+		break;
+
+	        }
+
+		return 0;
+	}
+}
+--------------------------- END CODE -------------------------------------
+
+Actual Results:
+Accpet Connection from: 127.0.0.1:1225
+Can Read: 127.0.0.1:1225 i=0
+Can Read: 127.0.0.1:1225 i=1
+
+Expected Results:
+Accpet Connection from: 127.0.0.1:1224
+Can Read: 127.0.0.1:1224 i=0
+Can Write: 127.0.0.1:1224 i=0
+
+
+How often does this happen? 
+1.1.8 Windows Version not tested on Unix/Linux Platform
+
+Additional Information:


More information about the mono-bugs mailing list