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

  • SEARCH
  • Home
  • 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 8429959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:28:45+00:00 2026-06-10T05:28:45+00:00

When reading through this Async Sockets example , I find this code: // Get

  • 0

When reading through this Async Sockets example, I find this code:

    // Get the socket that handles the client request.
    Socket listener = (Socket) ar.AsyncState;
    Socket handler = listener.EndAccept(ar);

I’m having trouble finding documentation on what the difference between these 2 sockets is and I’d also like to know how shutting down the handler, or closing the handler will effect the original socket. Can anyone explain this, or point me to some documentation?

  • 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-10T05:28:46+00:00Added an answer on June 10, 2026 at 5:28 am

    A socket is a unique connection on a particular machine i.e. 127.0.0.1:1024. Only one active connection can be made at a time. The “listener” listens on a fix port (e.g. 1024 in my above example). It’s job is to be a “public” way of accepting connections. Once it accepts a connection it creates a new socket on a new, randomly (well, reasonably pseudo-randomly), select port. Then the original connecting application and the host can communicate over that socket freeing the listening socket to get another connection (which would dole out another port number for a new connection, and so on).

    EndAccept is usually all you need to do once you’ve got a connection. The listener usually goes on the listen for more connections to accept. If not, you’ll usually just dispose or close the socket to stop listening and cancel any pending accepts. The handler is used to do whatever communication your application needs to, completely independently of the listener socket. When you’re done with the handler socket you dispose or close it and because the listener is independent it continues “running”.

    Shutdown will flush any pending data on a connection-oriented socket (to be called before Close) and won’t affect any other sockets.

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

Sidebar

Related Questions

Can Any one help me reading this XML and Looping through <MedicationDispensed> I get
Reading through the SendAsync , BeginAsync method illustrations of Socket s, I realized that
I was reading through K&R and i came across this example about uncertainty in
I was reading through the c++ Primer and this code snippet came up and
I have been reading through this similar question and find myself less than satisfied
I was reading through this tutorial , and at one point in the code,
I was reading through some JMockit examples and found this code: final List<OrderItem> actualItems
I was reading through the hadoop code and found this line in a partitioner.
I was reading through some of the responses in this question and saw that
Reading through the Backbone.js source code, I saw this: validObj[attr] = void 0; What

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.