Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi can somone help me debug this code. This is the client side code I created a UDP client/server chat room for multiple users. The

Hi can somone help me debug this code. This is the client side code I created a UDP client/server chat room for multiple users. The declaring the "serverConnection" as "serverConn" is giving me a problem. import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.*; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class ChatClient { private static final int SERVER_PORT = 9090; private static final String SERVER_IP = "127.0.0.1"; // ip of self computer private static BufferedReader input; //temp public static void main(String[] args) throws IOException { Socket socket = new Socket(SERVER_IP, SERVER_PORT); //creating Socket with the ip of server and port ** serverConnection serverConn = new serverConnection(socket); //having issue declaring this BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in)); PrintWriter output = new PrintWriter(socket.getOutputStream(), true); ** new Thread(serverConn).start(); // also geting a error here while (true) { System.out.println(">"); String command = keyboard.readLine(); if (command.equals("quit")) break; // if user inputs quit it will end program output.println(command); } socket.close(); System.exit(0); } }

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

More Books

Students also viewed these Accounting questions