Package Exports
- kn-lan-chat
- kn-lan-chat/dist/server/tcps.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kn-lan-chat) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
TCP LAN Chat CLI App
A TypeScript + Node.js TCP chat application with a server CLI and client CLI. It supports multiple connected clients, private messaging, broadcast messaging, client listing, and IP ban management.
Client Commands
-ccn <name>: set/change your client name-cnum <number> <msg>: send message to client by list index-cname <name> <msg>: send private message by client name-cname <name>: set persistent private recipient mode-rm: clear persistent recipient mode-cn: show your current client name-cl: list connected clients-bc <msg>: broadcast to all clients (with y/n confirmation)-hor-help: show command helpexit: disconnect client
Persistent recipient mode flow:
1) Run: -cname alice
2) Type plain messages (without command prefix)
3) Messages are sent to alice automatically
4) Run: -rm to exit this modeServer Commands
-bc <msg>: broadcast server message to all clients (with y/n confirmation)-cname <clientname> <msg>: send private message to client by name-cnum <clientIndex> <msg>: send private message to client by index-cl: show all connected clients on the server console-ban <clientname>: ban client by name and disconnect them-bf list: show ban list frombanlist.txt-bf clear: clearbanlist.txt-hor-help: show command helpexit: intended to stop server (useCtrl+Cas the reliable shutdown path)
Message Routing Behavior
- Private by name:
- Client sends:
-cname <target> <msg> - Recipient receives formatted private message.
- Client sends:
- Private by number:
- Uses the index from
-cllist.
- Uses the index from
- Broadcast:
- Sent to all other clients.
- Sender gets success feedback.
Ban System
- Bans are IP-based.
BanManagerstores in-memory bans and appends tobanlist.txt.- On new connection, server checks both in-memory list and file list.
- Banned clients are disconnected with a rejection message.
If installed globally from npm, binaries are:
npm i -g kn-lan-chatklcs-> start serverklcc-> start client
Quick Local Test
Terminal 1:
klcs -- -p 5000 -ip localhost -sn TestServerTerminal 2:
klcc -- -p 5000 -ip localhost -cn karan1Terminal 3:
klcc -- -p 5000 -ip localhost -cn user22Then test:
-cl-cname user22 hello-bc hello everyone-ban user22from server terminal
License
MIT