Linux Chat Room Program
======================================= Objective =======================================
Advanced Programming in Linux Environment (Part 1)
Implement a multi-user chat room program using TCP protocol with threading. (2 weeks)
The following features must be implemented:
-
A server-side program capable of handling multiple client programs.
-
Support for one-to-one and one-to-many chat.
-
File transfer functionality.
-
File integrity verification.
-
Demonstrate solutions for resolving shared resource conflicts in inter-thread communication.

===================================================================================
1. Introduction
- Can JAVA GUI applications run on Linux?
Java compiles into bytecode, which is platform-independent and executed by the JVM. Therefore, .class files can run anywhere a JVM is available.
- Can Java programs compiled on Windows run on Linux?
Can a program compiled with JDK for Windows run in a Linux environment using JDK for Linux? Also, can JBoss, which runs well on Windows, operate on Linux?
Answer: Java bytecode is platform-independent and interpreted by the JVM. Hence, .class files can run on any platform with a compatible JVM.
- Can Java be installed on Linux?
Yes. Installation instructions can be found at: http://blog.csdn.net/yeyuangen/article/details/6728004
- Can a chat room program developed on Linux run on Windows?
Answer: Yes, provided the program is written in a platform-independent manner (e.g., using Java with proper cross-platform considerations).
- What is a server-side application? What are the differences between server-side and client-side programs?
Answer: The server must use multithreading because it handles multiple concurrent tasks.
- Ericsson server, debug? What needs to be done?
Answer: Learn more from Hanbin, and attend the IBM training on September 23.
- Login interface related
Answer: Username and password (retrieval and matching via a small database)
- Purpose of the server-side
Answer: Forwarding data between clients
- How do clients communicate with each other? For example, how do they send files?
Answer: All communication and decisions must go through the server.
-
Other features: Screen shake, add friends
-
How to test on a single machine? How to test over a network (using two computers)?
2. Multithreaded Communication and Mutual Exclusion
============
Multithreading
============
- Does this need to run on ARM?
Answer: Running on a PC is sufficient.
- Can this be written in Java, or must it be in C?
Answer: Use C. The goal is to gain hands-on experience with thread control, conflict resolution, and inter-thread communication.
- How should multithreading be implemented effectively? How to better understand multithreading? How to gradually grasp the theoretical implementation of multithreading from practical applications? (Clear mental model)
Answer:
- How to resolve communication conflicts? How to ensure orderly access?
3. Network Programming
===========
Socket
===========
-
Socket programming
-
TCP
-
Network
-
What is the essence of a socket?
Answer: It is I/O—specifically, file I/O.
-
How to use sockets proficiently?
-
What are the key terms and concepts in socket programming? (Beginner level)
-
How to implement socket programming? Run through example code to gain intuitive understanding.
-
What is the first principle of socket programming?
4. Running Sample Programs
-
How to run sample programs?
-
What can be learned from running sample programs?
Answer: Gain an intuitive understanding of threads and build motivation for learning multithreading.
5. MIT Practice
- It seems that changing strategy from Java or Qt implementation is necessary: Just work independently in your dorm. Building something like QQ could actually be quite inspiring.