Question: Please answer the coding as below highlight. package mutu.pos.server; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; /** * */ public class POSServer { private static final

Please answer the coding as below highlight.

package mutu.pos.server;

import java.io.IOException; import java.net.ServerSocket; import java.net.Socket;

/** * */ public class POSServer {

private static final String STOCKSFILE = "stocks.csv"; private static final String TRANSFILE = "trans.csv"; /** * @param args the command line arguments */ public static void main(String args[]){ try{ String desktopPath = System.getProperty("user.home") + "/Desktop/"; SharedObject _obj = new SharedObject(desktopPath + STOCKSFILE, desktopPath + TRANSFILE); //1. create a server Socket ServerSocket ssk = new ServerSocket(12345); System.out.println("Server started"); while(true){ //2. get the client socket Socket _skt = ssk.accept(); //3. create the client handler object and pass the _obj to it ClientHandler _h = new ClientHandler(_obj, _skt); //4. start the client handler new Thread(_h).start(); System.out.println("A connection received"); } } catch (IOException ioe){ System.out.println(ioe.getMessage()); }//end of try-catch }//end of main() }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!