A TCP-based group chat server written in Go, modelled after the NetCat (nc) utility.
Net-Cat runs as a TCP server that accepts multiple client connections. Clients connect using the standard nc command and can send messages to the group in real time. The server handles join/leave notifications, message history, and concurrent connections safely.
$ ./TCPChat # Listens on default port 8989
$ ./TCPChat 2525 # Listens on selected port 2525. Accepts ports 0-65535$ nc <host-ip> <port>- TCP server accepting up to 10 simultaneous clients
- Messages are timestamped and identified by sender:
[2020-01-20 15:48:41][name]:message - New clients receive full message history on join
- All clients are notified when someone joins or leaves
- Empty messages are not broadcast
- Client disconnection does not affect other clients
- Concurrent connections handled safely with goroutines, channels and mutexes
All machines must be on the same local network. Find the server machine's local IP with:
$ ip aThen connect from another machine:
$ nc 192.168.x.x <port>Start the server on localhost
./TCPChat localhost <port>Simulate different clients by opening different terminals
nc localhost <port>Send messages from one client terminal to the other.