Add [0] TCP Server & Client - Bash implementation - cchopin - #53
Open
cchopin wants to merge 2 commits into
Open
Conversation
- 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
- 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
kurogai
reviewed
Oct 20, 2025
| @@ -0,0 +1,61 @@ | |||
| Dim 28 sep 2025 11:52:12 CEST: client_4547: ewd | |||
Owner
There was a problem hiding this comment.
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 |
Owner
There was a problem hiding this comment.
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 |
Owner
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.