Question: TCP Socket Programming (PC to PC) Create a Server side socket programming. The server side will send out a message every second. Setup server

TCP Socket Programming (PC to PC) Create a Server side socket programming. The server side will send out a message every second. Setup server socket with a port number. Assume the port number is 8081.+ Create a message for sending out the client. You will need to use: BufferedWriter. OutputStreamWriter. s.getOutputStream(+ The mapping should be like the following: new BufferedWriter(new OutputStreamWriter(s.getOutputStream()))+ Input the message by writing it into the buffer-writer. The code will look like the following: write( ); < Use the "flush" method to push the data out from the buffer. flush(); < But if the data is not enough to perform a push effect, the newLine() method to give a break point on the buffer. The looping can be done by using thread and a loop. Set the thread to sleep for every 1000 millisecond by using the "sleep" method. The client side is similar like server side; it only omits the ServerSocket. The IP is referring to Server side and port number is referring to the opened port that server side turned on. Create a message for receiveddata from server. You will need to use: BufferedReader. InputStreamReader. s.getInputStream(+ The mapping should be like the following:+ new BufferedReader (new InputStreamReader(s. getinputStream()))+ In order to read the message, you will need to use the "readLine" method.+ .readLine(); < Please always check if the received data is NULL or not. If the data is not NULL, print out a line of words of that message. There is also a looping feature and a thread in the client side. In order to lower the amount of client process, set the thread to sleep for every 1000 millisecond by using the "sleep" method. P P +
Step by Step Solution
There are 3 Steps involved in it
Heres a Java code example for the serverside socket programming import javaio import javanet public ... View full answer
Get step-by-step solutions from verified subject matter experts
