Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7686159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:25:01+00:00 2026-05-31T19:25:01+00:00

I’ve figured out that default ReceiveBufferSize (8192) doesn’t work for me – I lose

  • 0

I’ve figured out that default ReceiveBufferSize (8192) doesn’t work for me – I lose packet
Sockets: sometimes (rarely) packets are lost during receiving

However msdn has warning about increasing BufferSize:

http://msdn.microsoft.com/ru-ru/library/system.net.sockets.socket.receivebuffersize.aspx
A larger buffer size potentially reduces the number of empty acknowledgements (TCP packets with no data portion), but might also delay the recognition of connection difficulties. Consider increasing the buffer size if you are transferring large files, or you are using a high bandwidth, high latency connection (such as a satellite broadband provider.)

I know that I need to receive ~2000 packets per second and each datagram contains about 50-100 bytes of data. I’m using low-latency connection (everything in lan). I’m receiving stock exchange data from udp multicast so sometimes traffic my significantly jump (lehman brothers bankruptcy etc.) but let’s assume that I will not receive more than 20 000 packets per second.

How to calculate ReceiveBufferSize that will fit my needs?

I absolutely not agree to lose packets, but I do not lose perfomance or reliability or anything else as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:25:02+00:00Added an answer on May 31, 2026 at 7:25 pm

    There is no ideal figure one can give you for ReceiveBufferSize based on the info you have provided.
    Apart from your worse-case incoming data rate, it depends on the rate at which you process messages and whether you can continue to do so when you are being bombarded with messages.

    As mentioned in the comment to you question, you should profile you application under stressful conditions to discover the best value that works all the time for you.

    Alternatively, you could start with the default value of ReceiveBufferSize and increase it when you cross a threshold where you expect to lose packets bringing it down again when the situation normalizes. This approach is a lot of work.

    EDITED:

    On an average, you will be processing data faster that you receive it. But, there will be situations where you may not be able to process data at all (example, you may have to write to a database synchronously or serially every 100 messages you receive). In that case, you will have to ensure that your buffer can handle data coming in at that moment.

    Since, in the worse case you can receive up to 20k packets per second each of size 100 bytes, if you set the buffer size to say 2 MB (20k * 100 bytes) you should be able to go for about a second without processing any data coming from the far end.

    Likewise, if the longest you expect your thread to go without reading from the buffer is x seconds then you buffer size should be x * 2 MB + (expected size of buffer at such a time)

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.