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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:43:15+00:00 2026-06-17T04:43:15+00:00

I successfully developed an app which you can create/connect to a server. I have

  • 0

I successfully developed an app which you can create/connect to a server. I have a class named Person in which I have a public static LinkedList. In this list I’m storing clients who are connected to the server. The server/client classes are in the same package. The server and the client classes are extending Threads (they are working in the background).

What I’m trying to do.

  1. I want to send the online client list (LinkedList) to all clients who are connected to the server.
  2. I want to read data (String from StyledText) from clients and write it to the global main chat area (StyledText).

(something like mIRC program).

I have read and searched all day long, but I never saw a good explanation, example or documentation about “Java chat app”. I found with AWT, Swing, but the problem is I have knowledge only in SWT. Also, I found tutorials with TELNET, and the Input and Output Stream was read and wrote in the console (CMD). Am I need to use InputStreamReader, BufferedStreamReader and PrintWriter? If I have, am I need to convert those data in byte array then convert them into Objects?

I post some screenshots for a better understanding:

enter image description here

enter image description here

This is how I create the server:

DialogServer dialog = new DialogServer(new Shell());
dialog.create();
if(dialog.open() == Window.OK){
   new Server(serverAddress).start(); //dialog sets serverAddress as a String IP
}

Server class:

public class Server extends Thread{

    private static ServerSocket serverSocket;
    private static Socket socket;
    private static String address;

    public Server(String address){
        this.address = address;
    }

    public void run(){
        try {
            serverSocket = new ServerSocket(5000, 10, InetAddress.getByName(address));
            View.serverUp = true;
            View.log("Server is up. Listening on " + address + ":5000");
            Person p = new Person(View.nickname, true, 100.0);
            Person.listPeople.add(p); //add ADMIN to static LinkedList
            while(true){
                socket = serverSocket.accept();
                new Client(socket).start(); // client class thread
                refresOnlineList(); // refresh UI table
            }

        } catch (UnknownHostException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void refresOnlineList(){
        View.display.syncExec(new Runnable() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
                View.tableViewer.refresh();
                // TableViewer which contains online client list
            }
        });
    }
}

Dialog to connect to the server:

   DialogConnect dialog = new DialogConnect(new Shell());
   dialog.create();
   if(dialog.open() == Window.OK){
      new Client(connectAddress, connectNickname).start(); // dialog sets String parameters. new Client start a new Thread for a client.
   }

Client class:

public class Client extends Thread{
    private static Socket socket;
    private static String nickname;

    public Client(Socket socket){
        this.socket = socket;
    }

    public Client(String address, String nickname){
        socket = new Socket();
        try {
            socket.connect(new InetSocketAddress(address, 5000), 10);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            View.log("Cannot connect to server.");
        }

        this.nickname = nickname;
    }

    public void run(){
        try {
            Person p = new Person(nickname, false, 15.4);
            Person.listPeople.add(p); // add PERSON to static LinkedList
            socket.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

Developed in Eclipse RCP 3.8

  • 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-17T04:43:17+00:00Added an answer on June 17, 2026 at 4:43 am

    Your goal can be divided into three tasks:

    1. To create user interface
    2. To handle the network communication
    3. To bind those two together

    Stack Overflow is, AFAIK, not aimed to guide through whole project.
    You need to state specific question regarding specific problem.

    I’d suggest you to start with a console applications (client and server) to get rid of the burden of creating UI. When you’re done with that, you can create some UI and bind the events into it.

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

Sidebar

Related Questions

I have create a Windows Store app which successfully updates its tile (live tile).
I have developed an app that has work successfully for the last 4 months
I have developed an iPad app which is currently in the testing phase. I
I have successfully implemented a client/server Android GCM application. My app server holds a
I have developed an app running successfully on all the versions of android phones
I can't execute an app i have developed for iOs 5. It works fine
Ive developed an app for iPhone. Ive successfully tested it in the iPhone Simulator,
I have developed a view based project in Xcode. It is successfully running in
Im trying to create an ASMX Web Service in Visual Web Developer.I have successfully
I have developed a web based application which allows a client/user to upload a

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.