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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:44:20+00:00 2026-06-06T07:44:20+00:00

I’ve a task here and I am unable to finalize and not sure what

  • 0

I’ve a task here and I am unable to finalize and not sure what technology opt my problem. Here is the explanation of my problem. My application is stand alone application and will deploy in different locations. Lets say LocA, LocB and so on. Each location has its own clients some clients are connected via LAN and some are third party clients. As long as if the clients are connected via LAN no problem of requesting and response. But there will be few clients which are not connected via LAN.

To the third party clients we will provide IP and PORT to connect and request for data in a standard HL7 format. The problem here is the clients can create their own client program by using any technology. They may use Socket programming, .NET socket programming and so on. But our server should accept connections from clients what ever the technology it is, process their requests and respond back to them. And the requirement is the server program should run always and listens to the allotted ports or whenever there is a request to specific port then start our server program and process the client request and respond back to client.

Please pardon me if my English confuses you. Please give me a solution for my problem.

Note : Client program can be any technology and any programming language. That is up to client which way they want to use to connect with server and send their requests.

  • 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-06T07:44:22+00:00Added an answer on June 6, 2026 at 7:44 am

    I am giving a small example here, that how client and server works with Socket, i am also including the multithreading on the Server side.

    Client side code:

    public class ClientWala {
    
        public static void main(String[] args) throws Exception{
    
            Boolean b = true;
        Socket s = new Socket("127.0.0.1", 4444);
    
        System.out.println("connected: "+s.isConnected());
    
    
        OutputStream output = s.getOutputStream();
        PrintWriter pw = new PrintWriter(output,true);
    
        // to write data to server
        while(b){
    
            if (!b){
    
                 System.exit(0);
            }
    
            else {
                pw.write(new Scanner(System.in).nextLine());
            }
        }
    
    
        // to read data from server
        InputStream input   = s.getInputStream();
        InputStreamReader isr = new InputStreamReader(input);
        BufferedReader br = new BufferedReader(isr);
        String data = null;
    
        while ((data = br.readLine())!=null){
    
            // Print it using sysout, or do whatever you want with the incoming data from server
    
        }
    
    
    
    
        }
    }
    

    Server side code:

    import java.io.*
    import java.net.*;
    
    
    public class ServerTest {
    
        ServerSocket s;
    
        public void go() {
    
            try {
                s = new ServerSocket(44457);
    
                while (true) {
    
                    Socket incoming = s.accept();
                    Thread t = new Thread(new MyCon(incoming));
                    t.start();
                }
            } catch (IOException e) {
    
                e.printStackTrace();
            }
    
        }
    
        class MyCon implements Runnable {
    
            Socket incoming;
    
            public MyCon(Socket incoming) {
    
                this.incoming = incoming;
            }
    
            @Override
            public void run() {
    
                try {
                    PrintWriter pw = new PrintWriter(incoming.getOutputStream(),
                            true);
                    InputStreamReader isr = new InputStreamReader(
                            incoming.getInputStream());
                    BufferedReader br = new BufferedReader(isr);
                    String inp = null;
    
                    boolean isDone = true;
    
                    System.out.println("TYPE : BYE");
                    System.out.println();
                    while (isDone && ((inp = br.readLine()) != null)) {
    
                        System.out.println(inp);
                        if (inp.trim().equals("BYE")) {
                            System.out
                                    .println("THANKS FOR CONNECTING...Bye for now");
                            isDone = false;
                            s.close();
                        }
    
                    }
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    try {
                        s.close();
                    } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                    e.printStackTrace();
                }
    
            }
    
        }
    
        public static void main(String[] args) {
    
            new ServerTest().go();
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.