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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:41:16+00:00 2026-05-31T01:41:16+00:00

I have the following application which get launched as below: Runtime.getRuntime().exec(java -cp /var/dist/Test.jar System.V

  • 0

I have the following application which get launched as below:

Runtime.getRuntime().exec("java -cp /var/dist/Test.jar System.V PDP-11");

It has 10 to 20 second of task also it contain TCP/UDP server on port 1965. Once that task is complete, my another hand sends an TCP byte to shutdown the System.V

Runtime.getRuntime().exec("java -cp /var/dist/Test.jar System.V PDP-11/20");

Within less then 1 seconds another action executes as above, but that fails because port 1965 is already in use. But it was killed using System.exit(0)

How do i resolve that? So that it does not say “already in use port”? It seems like it takes lot of time to de-initialize the TCP or UDP ports that was listening via Java. (where nc -l port get lot faster killed).

Follow up:

i tried following but still it takes too while to get that port available (Linux OS).

byte[] buf = new byte[50];

sock.setSoTimeout(100);

  • 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-31T01:41:17+00:00Added an answer on May 31, 2026 at 1:41 am

    It takes some time for OS to “notice” that port can be used again – even if you close the socket and kill the application. Problem can be solved with following code:

    ServerSocket ss = ... //initialization of socket listening on port 1965
    ss.setReuseSocket(true);
    

    Please remember that code above is only a hint for OS that is should free port as fast as possible. Some exotic implementations of TCP stack might not honour this.

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

Sidebar

Related Questions

I have the following application which replicates an issue I'm having in a larger
I have an ASP.NET web application which does the following: Reads an Excel file.
I have a C# windows application which does the following: 1) the main form
I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll'
I have the following problem in application express which is driving me crazy: I
In a blog application (which I have mostly built following a tutorial), I would
I have created an application which has the following: A database created in VS2008,
I have following code which works fine in iPhone application but in iPad I
I am writing an android application to which I have granted the following privileges
i have following application(say App1) sitting on port 8888 on tomcat which is opening

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.