[Mono-bugs] [Bug 395168] New: Async Sockets with List<ArraySegment<byte>> -- Does Not Work
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed May 28 13:54:02 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=395168
Summary: Async Sockets with List<ArraySegment<byte>> -- Does Not
Work
Product: Mono: Runtime
Version: 1.9.0
Platform: PC
OS/Version: All
Status: NEW
Severity: Critical
Priority: P5 - None
Component: io-layer
AssignedTo: dick at novell.com
ReportedBy: kkoch at centralert.com
QAContact: mono-bugs at lists.ximian.com
Found By: Customer
Async sockets with List<ArraySegment<byte>> does not appear to work. I am
working with Mono on Windows AND on the Mac. I can get BeginReceive to work
using buffers, but not with List<ArraySegment<byte>>. Basically at some point
before the callback function is called I'm getting an Access Violation
exception in Mono itself. The same problem occurs with BeginSend.
I have written about the simplest possible test code shown below:
public class Tester
{
Socket _listenSocket;
Socket _outgoingSocket;
Socket _connected;
byte[] buffer = new byte[10000];
byte[] outBuffer = new byte[10000];
List<ArraySegment<byte>> _list = new List<ArraySegment<byte>>();
public Tester()
{
IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, 44444);
_listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
_listenSocket.Bind(endpoint);
_listenSocket.Listen(10);
_outgoingSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
_outgoingSocket.Connect("localhost", 44444);
_connected = _listenSocket.Accept();
ArraySegment<byte> seg = new ArraySegment<byte>(outBuffer, 0, 10);
_list.Add(seg);
_connected.BeginReceive(_list, SocketFlags.None, OnReceiveComplete,
_connected);
_outgoingSocket.BeginSend(buffer, 0, 0, SocketFlags.None, OnSendComplete,
null);
SocketError err;
_outgoingSocket.Send(outBuffer, 0, 10, SocketFlags.None, out err);
Thread.Sleep(1000);
}
public void OnReceiveComplete(IAsyncResult ar)
{
// Never gets called
int bytesReceived = _connected.EndReceive(ar);
Console.WriteLine("Bytes received: {0}", bytesReceived);
}
public void OnSendComplete(IAsyncResult ar)
{
// Does get called
Console.WriteLine("OnSendComplete");
int bytesSent = _outgoingSocket.EndSend(ar);
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list