How libinfaby/transitnet works
Project type and purpose
• TransitNet is a standalone desktop application built with WPF (.NET 8) that enables peer-to-peer file sharing, chat, and transfer monitoring over a LAN without a central server.
• It targets Windows 10/11 machines communicating via UDP (discovery/chat) and TCP (file transfer).
File structure
• Top-level files:
• App.xaml / App.xaml.cs – application entry point and resource/schema definitions
• MainWindow.xaml / MainWindow.xaml.cs – main UI shell with tabbed layout
• TransitNet.csproj / .slnx – .NET project and solution definitions
• Directories:
• Dialogs – XAML windows for settings, file sharing, etc.
• Models – POCOs for ChatMessage, FileTransfer, Peer
• Services – core network/service modules:
– PeerDiscoveryService (UDP broadcast)
– FileTransferService (TCP transfer + progress)
– ChatService (UDP chat)
– NetworkService (IP management)
– ThemeService (UI theming)
• No centralized database; storage is local file system (Documents/Downloads).
README for additional insights
• Clearly outlines network ports (8888 UDP for discovery, 8889 TCP for transfers, 8890 UDP for chat).
• Highlights modular architecture: four major services plus a UI orchestration layer.
• Mentions configuration and troubleshooting (firewall, custom paths).
1. Presentation/UI Layer (WPF)
– MainWindow, Dialogs
– Binds to Models and calls Services
2. Service Layer
– PeerDiscoveryService
– ChatService
– FileTransferService
– NetworkService
– ThemeService
3. Network Layer
– UDP Broadcast (ports 8888, 8890)
– TCP Socket (port 8889)
4. Local Storage
– File system (Downloads folder)
5. External Peers
– Other TransitNet instances on LAN
b. Relationships and interactions:
– UI Layer → Service Layer: user actions (Send File, Chat) invoke service APIs.
– PeerDiscoveryService ↔ Network Layer (UDP broadcasts/inbound responses) → updates Models → UI.
– ChatService ↔ Network Layer (UDP chat packets) ↔ other peers → ChatMessage models → UI.
– FileTransferService ↔ Network Layer (TCP streams) ↔ other peers → writes to Local Storage; updates FileTransfer models → UI.
– NetworkService provides helper functions (IP enumeration, port selection) to the other services.
c. Architectural patterns and principles:
– Modular service-oriented design: each concern (discovery, chat, transfer) is encapsulated in its own service.
– MVVM-inspired layering: XAML UI binds to Models and orchestrates Services (though code-behind is used).
– Event-driven updates: services raise events or callbacks to update UI in real time.
– Direct peer-to-peer communication: no central server, purely LAN broadcast/point-to-point.
d. Key technologies/frameworks:
– WPF (.NET 8) for UI
– C# async/await + Sockets (System.Net.Sockets)
– UDPClient / TcpListener / TcpClient
– .NET Dependency Injection (if used via Startup), otherwise manual service instantiation
– Local file I/O (System.IO)