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 8402011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:56:46+00:00 2026-06-09T21:56:46+00:00

Most people seem to build a listener socket and will include events to be

  • 0

Most people seem to build a listener socket and will include “events” to be invoked for processing. EG: SocketConnected, DataReceived. The programmer initializes a listener and binds to the “events” methods to receive socket events to build the service.

I feel on a large scale implementation, it would be more efficient to avoid delegates in the listener. And to complete all the processing in the callback methods. Possibly using different call backs for receiving data based on the knowledge of knowing what command is coming next. (This is part of my Message Frame Structure)

I have looked around for highly scalable examples, but I only find the standard MSDN implementations for asynchronous sockets or variations from other programmers that replicate the MSDN example.

Does anyone have any good experience that could point me in the right direction?


Note> The service will hold thousands of clients and in most cases, the clients stayed connected and updates received by the service will be send out to all other connected clients. It is a synchronized P2P type system for an object orientated database.

  • 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-06-09T21:56:47+00:00Added an answer on June 9, 2026 at 9:56 pm

    The difference between an event call and a callback is negligible. A callback is just the invocation of a delegate (or a function pointer). You can’t do asynchronous operation without some sort of callback and expect to get results of any kind.

    With events, they can be multicast. This means multiple callback calls–so that would be more costly because you calling multiple methods. But, if you’re doing that you probably need to do it–the alternative is to have multiple delegates and call them manually. So, there’d be no real benefit. Events can often include sender/eventargs; so, you’ve got that extra object and the creation of the eventargs instance; but I’ve never seen a situation where that affected performance.

    Personally, I don’t use the event-based asynchronous pattern–I’ve found (prior to .NET 4.5) that the asynchronous programming model to be more ubiquitous. In .NET 4.5 I much prefer the task asynchronous pattern (single methods that end in Async instead of two methods one starting with Begin and one starting with End) because they can be used with async/await and less wordy.

    Now, if the question is the difference between new AsyncCallback(Async_Send_Receive.Read_Callback) e.g.:

    s.BeginReceive(so.buffer, 0, StateObject.BUFFER_SIZE, 0, 
                                         new AsyncCallback(Async_Send_Receive.Read_Callback), so);
    

    and just Async_Send_Receive.Read_Callback e.g.:

    s.BeginReceive(so.buffer, 0, StateObject.BUFFER_SIZE, 0, 
                                         Async_Send_Receive.Read_Callback, so);
    

    The second is just a short-hand of the first; the AsyncCallback delegate is still created under the covers.

    But, as with most things; even if it’s generally accepted not to be noticeably different in performance, test and measure. If one way has more benefits (included performance) than another, use that one.

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

Sidebar

Related Questions

When implementing the INotifyPropertyChanged interface in its most basic form, most people seem to
This may seem obvious to most people, but I'm just trying to confirm that
I'll start in the way most people seem to have taken to, on here....
Most people (and the Oracle website) seem to refer to the JDK version as
This may seem trivial for most people but I am getting problems in determining
At this point most people will be thinking Ah ill post this..: byte[] dataB=
Most people seem to want to go the other way. I'm wondering if there
There is a directory in the standard ASP.NET template Content where most people seem
Most people seem to declare functions outside the code block that's using them like
I'm new to C++ and started to organize my code like most people seem

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.