top of page

Craft, activity and play ideas

Public·21 members
Ethan Walker
Ethan Walker

Java Swing Tutorials For Tic Tac Toe Program


This next server receives lines of text from a client and sends back the lines uppercased. It efficiently handles multiple clients at once: When a client connects, the server spawns a thread, dedicated to just that client, to read, uppercase, and reply. The server can listen for and serve other clients at the same time, so we have true concurrency.CapitalizeServer.javaimport java.io.IOException;import java.io.PrintWriter;import java.net.ServerSocket;import java.net.Socket;import java.util.Scanner;import java.util.concurrent.Executors;/** * A server program which accepts requests from clients to capitalize strings. * When a client connects, a new thread is started to handle it. Receiving * client data, capitalizing it, and sending the response back is all done on * the thread, allowing much greater throughput because more clients can be * handled concurrently. */public class CapitalizeServer /** * Runs the server. When a client connects, the server spawns a new thread to do * the servicing and immediately returns to listening. The application limits * the number of threads via a thread pool (otherwise millions of clients could * cause the server to run out of resources by allocating too many threads). */ public static void main(String[] args) throws Exception try (var listener = new ServerSocket(59898)) System.out.println("The capitalization server is running..."); var pool = Executors.newFixedThreadPool(20); while (true) pool.execute(new Capitalizer(listener.accept())); private static class Capitalizer implements Runnable private Socket socket; Capitalizer(Socket socket) this.socket = socket; @Override public void run() System.out.println("Connected: " + socket); try var in = new Scanner(socket.getInputStream()); var out = new PrintWriter(socket.getOutputStream(), true); while (in.hasNextLine()) out.println(in.nextLine().toUpperCase()); catch (Exception e) System.out.println("Error:" + socket); finally try socket.close(); catch (IOException e) System.out.println("Closed: " + socket); Discussion:




Java Swing Tutorials For Tic Tac Toe Program



In addition to your program, you should create a short video to present your work, the duration of which must not exceed two minutes. You should then upload the video to YouTube as an unlisted video (which means only people with the link to the video can watch it). Your video can make use of slides, screenshots, and/or voiceover effects but must include a live demo of your project. Your video should not include or discuss any code (e.g., no screen recordings of code). You may show the Intellij IDE (e.g., to run commands on the terminal) only if no .java files are open. 350c69d7ab


https://soundcloud.com/sazameytalh/sony-vegas-pro-free-download

https://soundcloud.com/tedchristie_1999/is-boris-fx-best-free

https://soundcloud.com/etperesni/d5-render-full-hot-download

About

Welcome to the group! You can connect with other members, ge...

Members