1. Server source import java.io.*; import java.net.*; public class Server { ServerSocket providerSocket ; Socket connection = null ; ObjectOutputStream out ; ObjectInputStream in ; String message ; Server() { } void run() { try { // 1. creating a server socket /* * port: the port number, or 0 to use a port number that is automatically allocated. * backlog requested maximum length of the queue of incoming connections. */ providerSocket = new ServerSocket(2004, 10); // 2. Wait for connection System. out .println( "Waiting for connection" ); connection = providerSocket .accept(); System. out .println( "Connection received from " + connection .getInetAddress().getHostName()); // 3. get Input and Output streams out = new ObjectOutputStream( connection .getOutputStream()); out .flush(); in = new ObjectInputStream( connection .getInp...
Think big, start small, move fast.