[Mono-bugs] [Bug 61608][Nor] New - RecvFrom_internal throws exception on connected socket

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 15 Jul 2004 11:49:08 -0400 (EDT)

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 dev@6wardlaw.freeserve.co.uk.


--- shadow/61608	2004-07-15 11:49:08.000000000 -0400
+++ shadow/61608.tmp.11648	2004-07-15 11:49:08.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 61608
+Product: Mono: Runtime
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: Fedora Core 1.0
+Status: NEW   
+Severity: Unknown
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dev@6wardlaw.freeserve.co.uk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: RecvFrom_internal throws exception on connected socket
+Description of Problem:
+When 'RecvFrom_internal' is called on a connected connection-oriented 
+socket, a 'System.SystemException' is thrown by the run-time.
+The exception is actually thrown in the 'create_object_from_sockaddr' 
+function where a check is made on the socket address length.
+Because the stack returns a socket address length of 0 ( correctly as 
+this is a connecte socket ) this check fails and the exception is thrown.
+Steps to reproduce the problem:
+1. Create a stream socket and connect it to a remote endpoint.
+2. Call ReceiveFrom on the local socket
+3. Send some data from the remote endpoint over the connection.
+Actual Results:
+Exception: System.SystemException
+Message: A system exception has occurred.
+in (unmanaged) (wrapper managed-to-native) 
+System.Net.Sockets.Socket:RecvFrom_internal (intptr,byte
+in <0x00004> (wrapper managed-to-native) 
+System.Net.Sockets.Socket:RecvFrom_internal (intptr,byte
+in <0x00050> System.Net.Sockets.Socket:ReceiveFrom_nochecks (byte
+in <0x00102> System.Net.Sockets.Socket:ReceiveFrom (byte
+in <0x00123> Codestuff.Core.Network.NetworkConnection:OnDataAvailable 
+Expected Results:
+No exception
+How often does this happen? 
+Additional Information:
+Suggest a fix to the runtime code which is attached. Note that this 
+should also be applied in conjunction with a fix to the Socket managed 
+class to prevent a NullReferenceException being thrown ( see attached )