Skip to content

Conversation

@cchopin
Copy link

@cchopin cchopin commented Sep 22, 2025

  • Cross-platform TCP server using netcat
  • Client with default server address handling
  • OS detection for Linux, macOS, and Windows
  • Comprehensive documentation and examples
  • Update gitignore with macOS exclusions

- Cross-platform TCP server using netcat
- Client with default server address handling
- OS detection for Linux, macOS, and Windows
- Comprehensive documentation and examples
- Update gitignore with macOS exclusions
@cchopin cchopin changed the title Add [0] TCP Server & Client - Bash implementation Add [0] TCP Server & Client - Bash implementation - cchopin Sep 22, 2025
- Implements multi-client real-time chat using pure bash and socat
- Features include message broadcasting, user management, and persistent
  logging
- Architecture uses TCP sockets with FIFO-based inter-process
  communication
- Includes server.sh, handle_client.sh, and client.sh components
- Clean user interface with "You:" vs "username:" message formatting
- Automatic cleanup on client disconnection
- Comprehensive README with architecture diagrams and troubleshooting
- Tested on macOS with support for 10+ concurrent users
@@ -0,0 +1,61 @@
Dim 28 sep 2025 11:52:12 CEST: client_4547: ewd
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expected? Didn't you missed to add an ".gitignore" for this entry?

echo "CONFIRM:$line"

# Save message
echo "$(date): $USERNAME: $line" >> messages.txt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting for your approach to store the messages in disk using an txt file.

A really nice implementation (not for this project, but in the future) would be to add encryption before storing the messages to protect the data.

# Broadcast to other clients
while IFS=':' read -r other_client_id other_username other_fifo; do
if [[ "$other_client_id" != "$CLIENT_ID" && -p "$other_fifo" ]]; then
echo "$USERNAME: $line" > "$other_fifo" 2>/dev/null || true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a nice example of command injection trought the client's names, i'll try to build an virtual machine with this server to see how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants