Skip to content

Conversation

@RobertBergman
Copy link

macOS Compatibility for TCP Server

This pull request adds cross-platform support for macOS while maintaining Linux compatibility.

Changes Made:

  1. Platform-Specific Headers:

    • Added conditional includes for Linux-specific headers (asm-generic/socket.h, endian.h, etc.)
    • Added macOS alternatives using the appropriate includes
  2. File Watcher Implementation:

    • Modified the file watcher to work on both platforms
    • Linux version uses inotify API
    • macOS version uses a polling-based approach
  3. Socket Options:

    • Fixed SO_REUSEPORT socket option that's not compatible with macOS
    • Used platform-specific socket option settings
  4. Documentation:

    • Updated README with macOS installation instructions
    • Added notes about platform-specific implementations

Testing:

All features have been tested on macOS and are working correctly:

  • HTML templating functions properly
  • WebSocket connections establish correctly
  • Hot reload feature works when modifying HTML files

These changes make the project truly cross-platform without sacrificing any functionality.

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.

3 participants