.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

SocketAsyncEventArgs buffer not ready

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :.NET Framework


I am using async socket operations to read data streamed from a server. I need to use async because commands can be sent to the server and I will receive response messages in an async manner. My problem though is that sometimes in our production environment the buffer that the Async operations write to isn't "ready" when I get a Completed event. That is; I read the BytesTransferred property on the SocketAsyncEventArgs object saying e.g. that 114 bytes was transferred, but the buffer is not updated with any content (all zeros). Since the HW in production is a dual quad core processor with hyper threading I assumed that it might be related to the memory model. But even if the buffer is marked as volatile the same problem occurs. 

The server is running Windows Server 2008 R2 Std Edition (x64) with 2xIntel Xeon E5520.

I hope you are able to put me on track here. I have done a lot of async server and client applications, but have never seen this issue before.



View Complete Post

More Related Resource Links

jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

Many call it the ASP.NET jQuery postback problem, but using the technique below should make it no problem anymore. $(document).ready() isn't called after an asynchronous postback. What this means? You lose the functionality that should be executed within $(document).ready() after an UpdatePanel rendered its contents after an asynchronous postback.

Ready made List Types provided by SharePoint

SharePoint provides some out of the box List Types. Some of the most used ready made list types that SharePoint provides currently are listed below:

World Ready: Around the World with ASP.NET AJAX Applications


The .NET Framework has excellent internationalization support, but JavaScript does not. If you're using ASP.NET AJAX, learn what you need to do to adapt.

Guy Smith-Ferrier

MSDN Magazine January 2008

Editor's Note: Get Ready for AJAX


If you're fortunate enough to attend a developer conference this year, look around at the variety of people. There are all kinds out there, a diverse ecosystem as the marketing folks might say. Even within a relatively narrow group like programmers, you'll find a wide range of goals and interests.

MSDN Magazine July 2006

Text Rendering: Build World-Ready Apps Using Complex Scripts In Windows Forms Controls


The System.Windows.Forms.TextRenderer class provides support for complex scripts in Windows Forms controls so you can render text the way you want and support international locales.

Miguel A. Lacouture

MSDN Magazine March 2006

Editor's Note: Get Ready For Microsoft Office 2003


Over the years, we've celebrated a lot of anniversaries in this column. Who can forget our "Ten Years of ENIAC!" Editor's Note back in June 1957? Or the "How Far We've Come: Five Years of the Altair 8800" issue back in January 1980? Or even the "Macintosh Interface: 15 Years Without an Update" Editor's Note page just four years ago?.

MSDN Magazine May 2003

Beyond Windows XP: Get Ready Now for the Upcoming 64-Bit Version of Windows


In this article the author modifies an industry standard middle-tier application server benchmark called Nile. The goal was to get it to build and run correctly on the 64-bit edition of the Microsoft .NET Advanced Server running on computers with Intel Itanium processors and still build as a 32-bit version to run on Pentium class x86 processors. While modifying Nile, the author discovered some of the tips he presents here. As the article explains, when modifying code for 64-bit Windows, data types are the key to success. The article discusses which types to use and when, along with new data types and the importance of memory alignment.

Stan Murawski

MSDN Magazine November 2001

.NET Interop: Get Ready for Microsoft .NET by Using Wrappers to Interact with COM-based Applications


Very soon, the development of Microsoft .NET applications will require interaction between those apps and existing COM components on both the client and the server. The .NET Framework has made provisions for this interaction by implementing various wrappers for COM objects to allow exposure of their properties and methods to .NET components. These wrappers will make it easy to make the connection between COM and .NET. After discussing wrappers, this article discusses other ways for .NET components to take part in COM+ transactions. To top off the tutorial on the interoperation of COM and .NET, the article discusses how ActiveX containers can host .NET controls, and how .NET containers can host ActiveX controls.

David S. Platt

MSDN Magazine August 2001

Windows UDP Socket Buffer (Maximum)

I am receiving on a socket (C#) and setting the UDP buffer size to br 10 Mb - and creating 16 such sockets. But I see missed UDP packets (they have  a unique seq number in them). When I read back "ReceiveBufferSize" it return the size I set it to - 10Mb.   My question is - what is the maximum internal socket buffer size allowed by Windows (Win Server 2008) ?   Wierdly when I also start Netmon in the background on the receiving machine - I do not see any missed packets.   Does Netmon modify internal windows socket buffers (increase them) - how can I go about doing this with my app ?   Thanks

TypePerf, Buffer Cache Hit Ratio, Page Life expectancy and some other counters....

Hello, I 've scheduled a Task on a Windows 2008 R2 Server (a Blade with 2 Processors (6 core HT) and 18 GB RAM) to check some SQL Server 2008 Performance Counters. The task runs TypePerf that checks the Counters every 15 seconds for 10 minutes. The task is scheduled every hour. The strange result is that Buffer Cache Hit Ratio, Page Life expectancy and some other Counters are ALWAYS = 0 but if I run PerfMon, Buffer Cache Hit Ratio is 100 and  Page Life expectancy >>>> 300. Any Idea? Thank youLuca Bovo MCTS - MCITP SQL Server 2005 (Database Administrator and Database Developer)

SQL Server 2005 buffer cache

Hello! I try to find out what objects use buffer cache. As example, in Oracle there is fixed table x$bh. This table gives us infomation about buffer cache on per block basis. Is there similar view or table in SQL Server 2005? How can I find out what table uses most of buffer cache?

Why WPF is not ready for LOB

Hi,      From what I read the capabilities of WPF, it makes sense to do any new development in WPF instead of Winforms for desktop applications.  Still, whole lot of people (MS inclusive) so far suggesting WinForms for LOB...  What does the community think?   thanks

some wcf errors after the application is ready!!!!!....URGENT

hi all, I have developed a wcf application that has wcf service hosted on IIS(for now locally),it has a client with a form UI that displays information to the user.. Im using BasicHttpBinding,all worked well before..the wcf service part was working very well and had no issues,but by the time i created a UI ,and retested it...,it gives errors.. the errors i googled but im confused what to do..there are 3 to 4 errors that i figure out randomly...the errors are as follows: 1."The HTTP request was forbidden with client authentication scheme 'Anonymous'.   2.The underlying connection was closed: The connection was closed unexpectedly.   3.Cannot access a disposed object. Object name: 'System.ServiceModel.Channels.ServiceChannel'.   are these errors related to each other??are they related to the same issue??..My application is developed and now i get these errors which never figured out before..   what do i do??plz do gv a fast and clear solution if possible..Im waiting for a quick  response..could someone solve this plz..!!   Thanks MumtazMumtaz Surani

Subscription reports Last Results as "Ready"

User setup subscription looks like it runs, but continues to report the "Last Results" for the subscription as "Ready".  The user never received the report, so it seems to be caught up in rendering to PDF or sending the email.  Any ideas on how to track this down?  I've set the subscription to fire immediately a couple of times and both times it runs and then gets caught in this "Ready" mode. We are on SQL Server 2008, but not R2 and we're running integrated with Sharepoint.  Thanks!!!

The operating system returned error 21(The device is not ready.)

Dear DBAs, A database backup job has failed for the last couple of days with below error. I see that there is no P drive for PP1DATA. When I tried to bring drives online to find P drive and bring it up I couldn't bring them online. Is the absence of P drive related to this error? Thank you,   ." failed with the following error: "The operating system returned error 21(The device is not ready.) to SQL Server during a write at offset 0x0000005ec32000 in file 'P:\PP1DATA1\PP1DATA1.mdf'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.  BACKUP DATABASE is terminating abnormally."

buffer data from a sql server database file

I'm in need of a sample code that will let me buffer data from a database so that I can go next> and <prev in a database file. Does someone have an idea on now to do this. Joe      Toppers BBS http://toppersbbs.dtdns.net C# Windows and Console applications. PHP, Mysql. HTML
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