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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:36:05+00:00 2026-06-12T02:36:05+00:00

What happens when you forget to close a ServerSocket in Java? Does the JVM

  • 0

What happens when you forget to close a ServerSocket in Java? Does the JVM or the TCP/IP stack automatically close it for you?

In addition when you close a ServerSocket does it also close all the associated Socket connections it spawned via the accept method?

  • 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-12T02:36:06+00:00Added an answer on June 12, 2026 at 2:36 am

    What happens when you forget to close a ServerSocket in Java?

    The GC will finalise the ServerSocket closing it eventually but you can’t say when this will happen (or possibly it might never happen)

    Does the JVM or the TCP/IP stack automatically close it for you?

    Its the JVM. The TCP/IP stack has no idea it should be closed.

    In addition when you close a ServerSocket does it also close all the associated Socket connections it spawned via the accept method?

    A ServerSocket is used for establishing a connection and once it has been accepted it is no different to those created on the client side. Closing the server socket has no effect on accepted connections. (It will close those which have not been accepted)

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

Sidebar

Related Questions

What happens in the following code? Does the synchronization work? This is an interview
What happens when an application pool is recycled in IIS 7? Does IIS abruptly
What happens if I call startUpdatingLocation while startMonitoringSignificantLocationChanges is running? Does significantLocationChange monitoring get
It sometimes happens to me that I forget to include a file in a
I've been working at this all day so I hope I don't forget any
Is there a reason why a Socket should close by itself, after 2h? I
I dad left Java since so long as a result now it happens that
I open a (Q)file in a function but I forget to close it (because
What happens when a thread is put to sleep by other thread, possible by
What happens in the following example? struct B { }; struct D1 : B

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.