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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:13:34+00:00 2026-05-16T12:13:34+00:00

I’m having an issue with the Socket.SendAsync method not detecting a dead TCP connection.

  • 0

I’m having an issue with the Socket.SendAsync method not detecting a dead TCP connection. In my client/server app, the server is sending heartbeats to connected clients in regular intervals.

The issue that I’m experiencing is that even though the client might be dead, the callbacks from the SendAsync method indicate “SocketError.Success” and the Socket.Connected property is true, even though the client is no longer “alive”. So, to the server it looks like the heartbeat data was sent properly and the client is still alive.

I’m seeing this issue every time, the client side PC is either put to sleep/hibernate or e.g. when the client is running in a VMWare instance and that instance becomes suspended. I do not see this issue when the client shuts down the application, kills it from the taskmanager, etc.

    internal void InternalSendAsync(ByteDataChunk chunk)
    {
        asyncSendArgs.SetBuffer(chunk.Buffer, 0, chunk.Offset);
        asyncSendArgs.UserToken = chunk;
        Socket.SendAsync(asyncSendArgs);
    }

    private void SendCompleted(object sender, SocketAsyncEventArgs args)
    {
        if (args.SocketError != SocketError.Success || !Socket.Connected)
        {
            InternalDisconnect(args.SocketError);
            return;
        }

        // all is good & do some other stuff
    }

Anybody has any idea what’s going on here and why the SendCompleted method does not return a SocketError even though the client is long dead (I’ve had the server run for multiple hours before and the dead socket was never detected)?

Thanks,

Tom

  • 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-16T12:13:35+00:00Added an answer on May 16, 2026 at 12:13 pm

    From MSDN:

    Note that the successful completion of
    the SendAsync method does not indicate
    that the data was successfully
    delivered.

    IMO, one of the most difficult parts about networking is you can’t be sure that the client ever got the data. If you are implementing a heartbeat system, you should have the client echo back the heartbeat, proving that it is still alive.

    When you suspend a process or hibernate the computer, I don’t think that the socket will be closed like it will if you shutdown the machine you are running on.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

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.