.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to use SocketAsyncEventArg.BufferList

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :.NET Framework

Hi I am trying to use the BufferList of the SocketAsyncEventArg to send multiple buffer. A small snippet of my Send() function looks like the following.


public void Send(byte[] data)
  e.SetBuffer(null, 0, 0);
  e.BufferList = new List<ArraySegment<byte>>();

  e.BufferList.Add(new ArraySegment<byte>(data, 0, data.Length));

  if (!_socket.SendAsync(e))

After I get connection setup with the remote listener, and call Send(), I keep getting the 'Invalid Argument' on the OnSendComplete() callback with e.SocketError = 'Invalid Argument'.

I checked that the e.Buffer value is null which is the pre-requisite per MSDN documentation.

Does anyone know what's wrong with the code and another question is if I use BufferList, do we still process the message on the Server in the same way that we do with e.SetBuffer() ?



View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend