Question
Need help running this Java program with a screenshot and brief detail of what the program does. import java.io.*; import java.net.*; import java.util.*; public class
Need help running this Java program with a screenshot and brief detail of what the program does.
import java.io.*;
import java.net.*;
import java.util.*;
public class BufferedServer
{
public static void main (String[] args)
{
try {
int portNumber = 0; // let the system find an available port
to use.
ServerSocket ss = new ServerSocket(portNumber);
System.out.println("Server listening at " +
InetAddress.getLocalHost() +
" on port " + ss.getLocalPort());
while (true)
{
Socket s = ss.accept(); // wait here for a
client to call
InputStreamReader isr = new
InputStreamReader(s.getInputStream());
BufferedReader br = new BufferedReader(isr);
String msg = br.readLine();
System.out.println(msg);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started