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

  • Home
  • SEARCH
  • 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 8970327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:42:50+00:00 2026-06-15T17:42:50+00:00

In my web-app the client is both the server and client at the same

  • 0

In my web-app the client is both the server and client at the same time. Just like in peer to peer applications.After the client starts the web-app, first thing that is done is : Check if the internet connection is available (As the jsp page is loaded ). If the connection is available,node information is sent over to the remote database. This is just to know the addresses of the nodes connected to the main server.

Now,if the node gets disconnected to the server (due to failure of internet connection or whatever) I want the node’s information to be removed from the database.

One way,I thought to implement this is to start a thread on the main server that keeps attempting a connection to all the nodes there in the database. But I am not happy with this option. Might be there is another way around. Or may be I can implement this in a better way.

Please suggest, how do I do this ?

And I have to start a thread on the main server, shall I call the thread function from the jsp page ? Like :

<%-- This is a jsp page --%>
.....
........
<%-- start a new thread that does that task --%>

<% new ThreadClass().startContinuousThread(); %>
......
.........

Note: Each node connects to the central server as :

      final URL url = new URL("http://sevrer/servlet");
      final HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
      int responseCode = urlc.getResponseCode();
      if(responseCode == 200){
          connected = true;
          System.out.println("Initial connection to the server successful");
      }

      // send the node information to the servlet via a 'parameterized query'.
  • 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-15T17:42:51+00:00Added an answer on June 15, 2026 at 5:42 pm

    Instead of doing this check on the server side, I would suggest you to do this check on the on the client send. Something like sending a ping request at a configured time interval.
    Just like your code that connects to the server, write code which calls another servlet periodically.

    final URL url = new URL("http://sevrer/pingServlet");
    final HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
    int responseCode = urlc.getResponseCode();
    

    The server would just keep a timer task which simply checks the last ping request that arrived for each node entry in the server. If the ping entry for any of the nodes did not arrive in the configured timeout interval then the server would clean up the node from it’s database.

    The advantage with this solution is your server would not be overloaded with initiating the requests everytime.However, I don’t see any improvements on I/O side, but the server side logic would be very clean and simple with this solution.

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

Sidebar

Related Questions

Typically when writing a web-app we want to perform validation on both client side
I am developing a reporting web app for a client of mine. Their accounting
I need to create a web app for a client, and one of the
Our client's web app restarts suddenly at random intervals. For each restart, we've found
I have a web app that lets a client define a daily rate for
I'm developing a web app for which the client wants us to query their
Client wants a button on the mobile web app that launches a QR code
A client im working for has created a web app that uses a password
I have a web app, where I keep a subdomain for every client eg:
Using SubSonic v2.3 in a web app. Each client (200+) will have their own

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.