How hugbrl09/chat-tcp-multiusuario works
This is a Java Swing multi-user TCP chat with a central server for nickname login, presence, public/private messages, and P2P file-transfer signaling; file bytes travel directly between clients. The workflow is connect and log in, exchange chat or presence updates through the server, then optionally negotiate and accept a direct file transfer. Server concurrency and its synchronized client registry are shown as an internal layer. Edges reflect excerpts or README claims; the receiver-side P2P socket details are not sampled.
Main entry points: TelaChat.java Chat interface · ServidorChatApp.java TCP acceptor and pool · ThreadCliente.java Per-client protocol handler · ServidorArquivoP2P.java Temporary file sender
Components 12
Swing Client
- Chat interface
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/TelaChat.java - Chat TCP connection
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/TelaChat.java
Central Chat Server
- TCP acceptor and pool
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/ServidorChatApp.java - Per-client protocol handler
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/ThreadCliente.java - Active client registry
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/GerenciadorClientes.java
Message Protocol
- Client message DTO
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/Mensagem.java - Server message DTO
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/Mensagem.java
Direct File Transfer
- Temporary file sender
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/ServidorArquivoP2P.java - File recipient
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/TelaChat.java
Other components
- Chat user
- Other chat participant
- Chat server service
Connections 14
- Chat user → Chat interface: uses
README.md - Chat interface → Client message DTO: creates and encodes
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/TelaChat.java - Chat interface → Chat TCP connection: sends chat commands
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/TelaChat.java - Chat TCP connection → TCP acceptor and pool: opens TCP connection
README.md - TCP acceptor and pool → Per-client protocol handler: dispatches clients
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/ServidorChatApp.java - Per-client protocol handler → Server message DTO: decodes and encodes
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/ThreadCliente.java - Per-client protocol handler → Active client registry: manages presence and routing
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/ThreadCliente.java - TCP acceptor and pool → Chat server service: listens for clients
ChatTCPServidor/src/main/java/com/mycompany/chattcpservidor/ServidorChatApp.java - Chat server service → Chat TCP connection: returns chat updates
README.md - Chat interface → Temporary file sender: starts file sender
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/TelaChat.java - Chat interface → Chat server service: signals transfer invitation
README.md - Chat server service → Other chat participant: forwards invitation
README.md - Other chat participant → File recipient: accepts or refuses
ChatTCPCliente/src/main/java/com/mycompany/chattcpcliente/TelaChat.java - File recipient → Temporary file sender: connects directly
README.md