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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:16:10+00:00 2026-05-26T11:16:10+00:00

I made an experiment: A server listens on port 8804 accepts a connection of

  • 0

I made an experiment:
A server listens on port 8804 accepts a connection of a client and then send data to the client endless. I shutdown the network.

  1. When I run netstat -anotp | grep 8804 ,it shows that the connection is “ESTABLISHED” on both server and client , but there is no data transmission.
  2. After a while , the server throw an error : “Connection time out”
  3. netstat -anotp | grep 8804 and found that the client is still “ESTABLISHED”

So:
1. Why does the server which is blocked on the system call “write” throw the “Connection timeout” error. Why not the client ?
2. How to let the client find the connection is shutdown actually.
3. Why are the server and client’s statuses both “ESTABLISHED” when the network does not work ?

Thanks for your answer !

  • 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-26T11:16:11+00:00Added an answer on May 26, 2026 at 11:16 am
    1. Your server is expecting TCP ACKs for individual data segments that it sends to the client; however, the client has no idea how long the server’s data is. Since you shutdown the network the server no longer gets ACKs from the client. Result: Connection timeout on the server (See Note 1)
    2. Use TCP Keepalives on your socket (See Note 2)
    3. You have not enabled TCP Keepalives. If you are using python, you can do so like this (assuming your socket is named s):
    # Do this before you accept() anything on the socket
    s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
    

    EDIT:
    Since you’re using C, a link to the Linux TCP Keepalives Howto

    NOTES

    1. RFC 1122: Section 4.2.3.5 "TCP Connection Failures"
    2. RFC 1122: Section 4.2.3.6 "TCP Keepalives"
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made an experiment in JavaScript: var x=[ 1,2,3,4,5,6]; c=(b = x)[2] ; //<---
I have made a simple, test program to experiment using classes. It creates a
I made a simple experiment, I wrote the following code in Xcode: int main(int
I've made some experimental code that I would like to save in the repository,
Made this nice little loop for hiding and showing div's, works as a charm
Made a custom obj called Item with some string fields and one float. .h
I made a function which displays date on the webpage,, and i uploaded the
I made the ultimate laugh generator using these rules. Can you implement it in
I made small program to divide large pictures and take part of them. When
I made the mistake of modifying my original source after importing it into subversion.

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.