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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:12:03+00:00 2026-05-11T08:12:03+00:00

A few words about an ongoing design and implementation I send a lot of

  • 0

A few words about an ongoing design and implementation

I send a lot of requests to the remote application (running on a different host, of course), and the application send back data.

About client

Client is a UI that spawn a separate thread to submit and process the requests. Once it submits all the requests, it calls Wait. And the Wait will parse all events coming the app and invoke client’s callbacks.

Below is the implementation of Wait.

public void Wait (uint milliseconds) {        while(_socket.IsConnected)        {          if (_socket.Poll(milliseconds, SelectMode.SelectRead))          {               // read info of the buffer and calls registered callbacks for the client               if(_socket.IsAvailable > 0)                     ProcessSocket(socket);          }          else             return; //returns after Poll has expired       } } 

The Wait is called from a separate thread, responsible for managing network connection: both inbound and outbound traffic:

         _Receiver = new Thread(DoWork);          _Receiver.IsBackground = true;          _Receiver.Start(this); 

This thread is created from UI component of the application.

The issue:

client sometimes sees delays in callbacks even though main application has sent the data on time. Notably, one the message in Poll was delayed until I client disconnected, and internally I called:

_socket.Shutdown(SocketShutdown.Both); 

I think something funky is happening in the Poll

Any suggestions on how to fix the issue or an alternative workaround?

Thanks

please let me know if anything is unclear

  • 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. 2026-05-11T08:12:03+00:00Added an answer on May 11, 2026 at 8:12 am

    A couple of things. First, in your example, is there a difference between ‘_socket’ and ‘socket’? Second, you are using the System.Net.Sockets.Socket class, right? I don’t see IsConnected or IsAvailable properties on that class in the MSDN documentation for any .NET version going back to 1.1. I assume these are both typing mistakes, right?

    Have you tried putting an ‘else’ clause on the ‘IsAvailable > 0’ test and writing a message to the Console/Output window, e.g.,

      if (_socket.IsAvailable > 0) {       ProcessSocket(socket);   } else {       Console.WriteLine('Poll() returned true but there is no data');   } 

    This might give you an idea of what might be going on in the larger context of your program.

    Aside from that, I’m not a big fan of polling sockets for data. As an alternative, is there a reason not to use the asynchronous Begin/EndReceive functions on the socket? I think it’d be straightforward to convert to the asynchronous model given the fact that you’re already using a separate thread to send and receive your data. Here is an example from MSDN. Additionally, I’ve added the typical implementation that I use of this mechanism to this SO post.

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

Sidebar

Ask A Question

Stats

  • Questions 81k
  • Answers 81k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do you have WebBrowser1.AllowNavigation set to true? Have you tried:… May 11, 2026 at 4:29 pm
  • Editorial Team
    Editorial Team added an answer Yes you can, you just need to use the <%… May 11, 2026 at 4:29 pm
  • Editorial Team
    Editorial Team added an answer Yes. From the Apple documentation: setContentOffset:animated: Sets the offset from… May 11, 2026 at 4:29 pm

Related Questions

I am new here so first of all my greetings to you I am
I've seen a few questions and answers on SO suggesting that MD5 is less
I am working on a few PHP projects that use MVC frameworks, and while
I have an iPhone app that hides the status bar. However, my main view

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.