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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:04:24+00:00 2026-06-01T00:04:24+00:00

I’m currently developing a client/server application in Java and i can’t make up my

  • 0

I’m currently developing a client/server application in Java and i can’t make up my mind on how to design the client.

At the moment i have a server that can accept multiple connections and every connection has a loop listening for commands and respond to them. The server looks like this:

    try{

        mIn = new DataInputStream(mSocket.getInputStream());
        mOut = new DataOutputStream(mSocket.getOutputStream());

        while(true){

            byte tPackType = mIn.readByte();

            switch(tPackType){

                case PackType.LOGIN:
                    login();
                    break;
                case PackType.REGISTER:
                    register();
                    break;
                default:

            }

        }

    }catch (IOException e){
        mLog.logp(Level.WARNING, this.getClass().getName(), "run()", "IOException in run()", e);
    }finally{
        try{
            mOut.close();
            mIn.close();
            mSocket.close();
        }catch (IOException e){
            e.printStackTrace();
        }
    }

Now, the client is basically just a number of methods sending a request to the server and returns the response. I want to be able to receive updates from the server.
I would appreciate any suggestions on reading that can help me find a solution.
Is there any patterns i could look into?

Thank you in advance, veLr.

  • 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-01T00:04:26+00:00Added an answer on June 1, 2026 at 12:04 am

    I want to be able to receive updates from the server

    I think that you have two options to do this.

    • Option 1 is to make your client poll the server for updates. I would not recommend this since this will eventually increase your load on your server. You will most likely have performance issue the moment you attempt to scale your system up.

    • Option 2 is to create a small server on your client. So basically, whenever there is an update, the server would connect to the client and send it the updates. I would recommend this procedure since it allows you to establish connections between your server and clients only when needed. The problem, when opposed to the previous method, is that you will need to track of the ports and IP’s of your clients. You could implement a HashTable with Client ID’s as keys and their connection properties as their keys. Once you have an update, you will look up the client in the HashTable, obtain the connection information, connect and send the information.

    The server on the client side will then get the data and do whatever you want the client to do once an update is received.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

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.