Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**Please, Create Pictures and, Flow Charts of this Chat Software Application Java Programming Language Project and, also for it's output.** **Please, Create pictures and, flow

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

**Please, Create Pictures and, Flow Charts of this Chat Software Application Java Programming Language Project and, also for it's output.** **Please, Create pictures and, flow charts in a way that everyone understands, what I wanted to do on this project and, what I meant by this Project and, it's all classes. Please, give a detailed flow charts and pictures for it's output also.** **Also write full path and, scenario of this Java project.** **Write a detailed description of this Java Programming Language project. Write this description such a way that, I can copy and, paste this anywhere.** **Write in such a way, that all the writings are fully correct.** 
hey there! I have solution which might interest you! In accordance for this project to work we need a server, what we can do is create to localhost or any other connected main machine server which will make and handle user requests and messages requests. After this we need a User class to add and delete user's session, which is our ultimately import task. our user class will have certain function like addUser, getUser, DeleteUser to process user requests that will ultimately we send to the server and then processed. the first task is to create Server.java file to handle all the inputs and requests. Server.java import java.io.*; import java.net.ServerSocket; import java.net.Socket; import java.util.HashSet; import java.util.Set; public class Server Set(); int port; public Server(int p_num) throws Exception port=p_num; try (Server Socket serverinstance = new Server Socket(port) { System.out.println("listening on "+port); while(true) Socket acceptor=serverinstance.accept(); User newbie=new User(this, acceptor); System.out.println(newbie.name+" joined"); newbie.start(): void transmit(String msg, User current) { for (User user : activeUsers) { if (user != current) user.send(msg); ) else! System.out.println(msg): } new Server(Integer.parseInt(args[0]): class User extends Thread public String name: private Server host; private Socket conn; private Printwriter wr public User(Server host Socket conn) { this.conn=conn; this.host=host; } public void run tryl Buffered Reader parser=new Buffered Reader(new InputStreamReader(conn.getinputStream()): wr=new Printwriter conn.getOutputStream().true): if(host.activeUsers.isEmptyOX wr.println("Hey Early bird, You are first"); ) else! wr.println("We have some friend(s) for you!"); for(User ihost.activeUsers iffi.namel=null) wr.println(i.name+", " } wr.println(); name=parser.readLinel); host.active Users.add(this): String msg=name="Connected!" host.transmit(msg.this): while(true) msg=parser.readLine(): String msg1="["+name+") +msg: host transmit[msgi, this): if(msg.equals("bye")break ) host.active Users.remove(this); conn.close: msg=namet" offline" System.out.println(msg): host.transmit(msg, this): }catch(Exception err) try throw new Exception("Error: "terr.getMessage(): } catch (Exception e) { e.printStackTrace(); ) } void send/String msgk wr.println(msg): } editor images for the same will go like this: import java.util.Set; public class Server 12 13 14 15 16 Set(); int port; public Server(int p_num) throws Exception port=p_num; try (Server Socket serverInstance - new Server Socket(port)) { System.out.println("listening on "+port); while(true) { Socket acceptor-serverInstance.accept(); User newbie new User(this, acceptor); System.out.println(newbie.name:" joined"); newbie.start(); 18 20 26 } void transmit(String msg, User current) ( for (User user : activeUsers) { if (user !- current) { user.send(msg); } else{ System.out.println(msg); ) } } Run Debug public static void main(String[] args) throws Exception if(args.length String res=r.readLine System.out.println(" -res: if client name=null System.out.printl""+client namet"; "% 1 catch(Exceptioner System.out.println("Error: "terr.getMessage(): 1 class Write extends Thread private Print Writer wr; private Socket conn; private Client client public Write(Socket conn.Client client) throws IOException this.conneconn. this client client tryl wr=new Printwinterconn.getOutputStreami)true): catch(OException en System.out.println("ERROR: "rer.getMessage: public void run Console consoleSystem.console client.name-console.readLine(" Enter your name: wr.println(client name: String msg while(true) msg=console.readLineT+client.name+"): wr.printinmag if(msg.equals("bye break; ) try! con closel: catch (IOException e) { e.printStackTracelli editor images pa CB LE utile string me putile Client(int parts String host) thru Ucrestexcestion, excestion Sacket com Socket(host.port); System.out.println("You're in!") me teadcm).start(); write(cortis).start(): System.out.println("Thanks For Call 13 14 tantes public static void main(Strinell are Fargs. In the System.out.println("Syntax jew Client hoa transport"); try new Cilent (Integer.parseInt([1]. []); catch(Exception ere) System.out.println("Syntax error: should be "jeva Client hostome porti""); System.out.println(err.getMessage()); class Read extends Thread private Bufferedder private Client client; public Read [Socket consent client) throws Exception renew Bufferedresser new Troutstreamleader com.getInputStream()) this clients public void run tryl String repeatine(); System.out.pretineres If clients System.out.print(".client."): "); catch(Exceptes er System.out.rintin("Error: erretressage) Facerte el Tran private Sacket cons private Client clienti Write a content and the option this.com this.chiestachten en Printeriter(con.getOutputStream().true); }catch (IOException ere) System.out.printin("ERROR: err.petressage()); public void run Console colesystem.console(); client.console.readLine"inter your name: *); ww-print in client.name): Strings while(true) Sponsole.readLine("["+client.name"]: -); w.println(eses 16(es.equals("yerer com.close(); } catch (IOException e) { e.printStackTrace(); output for the same will look like this here our first task is to run server class with java Server 8080 and then for particular client we need to start our client class with java Client localhost 0000 finally you will receive a screen with server status Thanks For Coming! Hey Early bird, You are first with je C:\Users Shivanshu DE and trou're in! Thanks for coming! with je Enter your name: bcd [bcd]: and on server it will look like this: listening on 8888 null joined bcd Connected! null joined abc Connected! [abc] hi

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions