Diferență între revizuiri ale paginii „OOP Lab Task 6”
De la WikiLabs
Jump to navigationJump to searchLinia 40: | Linia 40: | ||
* The assignment will be evaluated automatically by the [http://homework.dcae.pub.ro:8888/Web-CAT/WebObjects/Web-CAT.woa Web-CAT] platform. | * The assignment will be evaluated automatically by the [http://homework.dcae.pub.ro:8888/Web-CAT/WebObjects/Web-CAT.woa Web-CAT] platform. | ||
* You could access the Web-CAT platform using the username and the password with which you acces the <span style="color:red">electronica.curs.pub.ro</span> intranet. | * You could access the Web-CAT platform using the username and the password with which you acces the <span style="color:red">electronica.curs.pub.ro</span> intranet. | ||
− | * Select the OOP Lab Task | + | * Select the OOP Lab Task 6 assignment. |
* Submit your work as a single .zip archive (give it whatever name you choose) containing only the Java source code files. | * Submit your work as a single .zip archive (give it whatever name you choose) containing only the Java source code files. | ||
* <font color="red">'''Attention'''</font> Any deviation from these instructions may lead to the loss of the entire amount of points. | * <font color="red">'''Attention'''</font> Any deviation from these instructions may lead to the loss of the entire amount of points. |
Versiunea de la data 12 ianuarie 2016 19:12
Required Tutorials
- The Object Oriented Paradigm; Classes and Objects
- Notions About the Java Language
- Writing and Executing a Java Program
- Java Syntax; A Program's Lexical Structure
- Coding Conventions
- Advanced Notions About Object Oriented Programming
- Java Application Programming Interface (API) (EN)
- Exception Handling
- Input/Output Streams
- Serialization
- Network Sockets
- Concurrent Programming - Threads
- Graphical User Interface (GUI) - Java Swing and JavaFX
Requirements
- Modify class ClientPeer written for the previous assignment, making it into a thread which, in parallel with the main execution thread, has to read objects of type Message from the server and write them on the screen.
- Modify class ServerPeer written for the previous assignment, making it into a thread. This new thread must read objects of type Message and PrivateMessage from the associated client and correctly distribute them to the other clients.
- Modify class Server written for the previous assignment, such that when a new client connects, the Server main thread should create a new ServerPeer and start it as a Thread, and then return to blocking in method ServerSocket.accept(), waiting for a new incoming connection.
- The server should not accept a new connection if the current number of connected clients is already equal to property MAX_CLIENTS read from the server.conf configuration file by the class ServerConfig.
Notes:
- Class Server should keep a list of all the connected clients (objects of type ServerPeer). For this, you can use class java.util.ArrayList.
- This list should be kept consistent, meaning new clients should be added, and disconnected clients should be removed.
- This list should be available to the ServerPeer execution threads through synchronized methods.
- To check if an object is instance of a specific class, you can use operator instanceof:
Object o = ois.readOject();
if(o instanceof String){
String s = (String)o;
System.out.print(s);
}else{
System.out.print("The object is not a String!");
}
Submitting
- The assignment will be evaluated automatically by the Web-CAT platform.
- You could access the Web-CAT platform using the username and the password with which you acces the electronica.curs.pub.ro intranet.
- Select the OOP Lab Task 6 assignment.
- Submit your work as a single .zip archive (give it whatever name you choose) containing only the Java source code files.
- Attention Any deviation from these instructions may lead to the loss of the entire amount of points.