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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:21:33+00:00 2026-05-17T21:21:33+00:00

I have a single-threaded non-blocking socket IO server written in Java using nio. When

  • 0

I have a single-threaded non-blocking socket IO server written in Java using nio.

When I have finished writing to a connection, I want to close it.

Does the closing of the channel mean blocking until all buffered writes have been acknowledged by the recipient?

It would be useful to know if, when asynchronously closing, it succeeded or not, but I could live with any errors in the closing being ignored.

Is there any way to configure this, e.g. with setSoLinger() (and what settings would be appropriate?)

(A general discussion beyond Java about Linux and other OS in this respect would be useful to)

  • 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-17T21:21:33+00:00Added an answer on May 17, 2026 at 9:21 pm

    Closing in non-blocking mode is non-blocking.

    You could put the channel into blocking mode, set a positive linger timeout, and close, and that would block for up to the linger timeout while the socket send buffer was being emptied, but alas Java doesn’t throw an exception if the linger timeout expires, so you can’t know whether all the data has gone. I reported this bug ten or more years ago and it came back ‘will not fix’ because of compatiblity concerns. If you can wait until Java 7 comes out I believe the nio2 stuff has this fixed, I certainly requested it, but who knows when that will be?

    And even if you have all that, all you know is that the data was sent. You don’t know anything about it being received or processed by the recipient application. If you need that you have to build it into your application protocol.

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

Sidebar

Related Questions

I have an single threaded, embedded application that allocates and deallocates lots and lots
I have worked on single threaded business logic/back-end programming for most of my career.
I normally work on single threaded applications and have generally never really bothered with
I have a single user java program that I would like to have store
I have a single Rails 2.2.2 app that I want to 'share' with multiple
I have a single line CEikLabel in my application that needs to scroll text.
I have a single spool mbox file that was created with evolution, containing a
I have a single windows shell command I'd like to run (via EXEC master..xp_cmdshell)
I have a single entry output from a paradox table which is imported into
I have a single NSDictionary object which contains a large number of custom objects.

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.