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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:43:17+00:00 2026-05-28T14:43:17+00:00

I have a client-server architecture where there is a client connected to a Central

  • 0

I have a client-server architecture where there is a client connected to a Central Server and then I have this central Server connected to two Servers (Server1 and Server2). I pass a Map Object from the client to the CentralServer using the Serializable class. Then, in the CentralServer I want to get this Map Object and get the Key and the value from them. For that I am using the following code:

public void readObject(Map<String, byte[]> parObj)
{   
    for (String key : keys) 
    {
        if(parObj.containsKey(key) == true){
            foundAnyKey = true;
            byte[] values = parObj.get(key);
            //Do Something here
       }
   }
     if(foundAnyKey == true){
            //Do something here
     }
}

Correct me if I’m wrong. Am I doing this first part of getting the key and the value right?

The second part of my question is How can I send the keys that for instance begin with “a-f” to the Server1 and the keys that begin in “f-z” to the Server2. How can I do that?

In my main I have the following code:

System.out.println("Starting Server");
        ServerSocket ss = new ServerSocket(7776);  
        System.out.println("Server Started"); 
        Socket s = ss.accept();
        InputStream is = s.getInputStream();                    
        ObjectInputStream ois = new ObjectInputStream(is);      
        MapObject mo = (MapObject) ois.readObject();
        s.close();

This is where I get my MapObject form the client. Now I want to get the key and the value from this object.
Best regards

  • 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-28T14:43:18+00:00Added an answer on May 28, 2026 at 2:43 pm

    If you question is about an “ordered” map then you take a look to LinkedHashMap (if you care about insertion order) or a TreeMap (where you define a compareTo() method to have a sorting rule).
    Then you can loop the keys simply with the method

    Set keys = map.keySet();
    

    And then you can iterate over the (previously ordered) Set of keys.

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

Sidebar

Related Questions

I have to implement a client-server architecture where there are many android client located
I am developing an application in C# WPF which will have Client-Server architecture (Client
I have this situation.... Client-initiated SOAP 1.1 communication between one server and let's say,
When designing a client/server architecture, is there any advantage to multiplexing multiple connections from
We have a product built on the Client-Server architecture. Some details about the technology
We have what I think is a fairly typical client/server architecture, with a frontend
I have client/server applications and a very simple protocol for communication. More precisely, it's
We have client server based app which saves user related data into a zip
I have Client-Server environment and developed a project for Client-Server. I need to share
I have client and server programs which now communicate via TCP. I'm trying out

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.