mirror repo of https://github.com/littlequartz/clink. a socket programming assignment for Sistem Terdistribusi
Go to file
Syahdan b80c5190a3 feat(chat): CLI flags, centered header; improve server with selective broadcast and quit handling
Client/main:
- Add flags: -host (default "localhost:9000") and -server (run only server)
- When -server is set, startTCPServer(host) and exit
- Use provided host for client connection
- Center header with width-aware lipgloss styling; adjust padding

Server:
- Introduce broadcast struct {text string, exclude net.Conn}
- Hub.msgCh now chan broadcast; send messages with optional exclusion
- On join: send “[join] …” to others (exclude the joiner)
- Broadcast chat lines without exclusion; newline-delimited as before
- Handle “/quit” by breaking loop (graceful disconnect)
- On leave: broadcast “[leave] …” to all

Refactor notes:
- Remove unconditional embedded server from client startup
- Scanner loop unchanged aside from quit handling and broadcast usage
2025-10-15 11:25:16 +07:00
go.mod initial commit 2025-10-15 00:19:34 +07:00
go.sum initial commit 2025-10-15 00:19:34 +07:00
main.go feat(chat): CLI flags, centered header; improve server with selective broadcast and quit handling 2025-10-15 11:25:16 +07:00
server.go feat(chat): CLI flags, centered header; improve server with selective broadcast and quit handling 2025-10-15 11:25:16 +07:00