Skip to content

prielhoffman/multicast-internet-radio-system

Repository files navigation

Multicast Internet Radio System

A client-server internet radio system written in C, built with TCP control communication, UDP multicast audio streaming, and a custom application-layer protocol.

This project demonstrates low-level networking, concurrent server design, protocol implementation, and state-machine-based communication between clients and a streaming server.

Tech Stack

  • Language: C
  • Networking: TCP, UDP, UDP multicast
  • Concepts: socket programming, client-server architecture, multithreading, finite state machines, custom protocol design

What the Project Does

The system simulates an internet radio platform where multiple clients can connect to a server, receive information about available radio stations, join a multicast stream, switch between stations, and upload songs.

The communication is split into two channels:

  • TCP is used for control messages between the client and the server
  • UDP multicast is used for streaming audio data for each radio station

This separation makes the system closer to a real-world streaming design, where control and media delivery are handled differently.

Main Features

  • Multi-client server architecture
  • TCP-based control channel
  • UDP multicast streaming for radio stations
  • Dynamic station switching
  • Song upload support
  • Custom application-layer message protocol
  • Finite State Machine logic for both client and server
  • Multithreaded handling of communication and streaming flows

System Architecture

The project follows a client-server model:

  1. A client connects to the server over TCP
  2. The server responds with station and multicast information
  3. The client joins the appropriate UDP multicast group
  4. Audio is streamed over multicast
  5. The client can switch stations or upload new songs through the TCP control channel

High-Level Flow

  • Client → Server (TCP): connection setup, requests, control messages
  • Server → Client (TCP): welcome messages, station metadata, notifications
  • Server → Clients (UDP Multicast): audio streaming for active radio stations

Protocol Overview

The system uses a custom protocol to coordinate communication between the client and server.

Example message types include:

  • Hello – sent by the client to initiate communication
  • Welcome – sent by the server with available station and multicast details
  • AskSong – sent by the client when requesting a song-related action
  • Announce – sent by the server to notify clients about changes such as a new song or station update

The protocol was designed to keep the control plane explicit and structured while audio delivery happens separately through multicast streaming.

Finite State Machine Design

Both the client and the server use state-based logic to control behavior during communication.

Client-side states

  • Off
  • WelcomeWait
  • Established
  • NewStations

Server-side responsibilities

  • Accept client connections
  • Maintain session state
  • Manage station metadata
  • Stream content to multicast groups
  • Notify clients about updates

Using an FSM made it easier to separate connection setup, normal operation, and update handling in a predictable way.

What I Implemented

This project focused on building a complete low-level networking system rather than a single socket demo.

Key implementation areas included:

  • Designing and implementing the communication flow between client and server
  • Combining TCP and UDP multicast in one application
  • Managing radio stations as separate multicast streams
  • Handling client interaction and station switching
  • Supporting song upload behavior
  • Structuring protocol handling with finite state machines
  • Applying multithreaded design for concurrent communication

Why This Project Matters

This project demonstrates practical understanding of:

  • socket programming beyond basic examples
  • the difference between reliable control traffic and media streaming traffic
  • multicast-based communication
  • concurrent server design
  • protocol implementation at the application layer
  • state-machine-based networking logic

It is a good example of systems and networking work that goes beyond simple request-response applications.

Project Structure

Typical components in the project include:

  • client-side code for connection, control, and playback flow
  • server-side code for connection handling and streaming
  • protocol/message handling logic
  • state-management logic for communication flow

How to Run

  1. Clone the repository
  2. Build the client and server programs
  3. Set up a multicast-capable environment or use a network simulator such as GNS3
  4. Start the server
  5. Start one or more clients
  6. Connect to stations, switch streams, and test song upload behavior

Requirements

  • C compiler
  • Multicast-capable network environment or simulation setup
  • Audio playback support if required by the implementation
  • GNS3 or equivalent environment if testing through simulation

Key Takeaways

Through this project, I strengthened my understanding of:

  • low-level network programming in C
  • TCP vs. UDP design tradeoffs
  • multicast communication
  • concurrent server behavior
  • protocol and state-machine design

Future Improvements

Possible next steps for the project:

  • add clearer configuration for stations and ports
  • improve logging and error visibility
  • add automated test scenarios for protocol validation
  • document packet/message formats in more detail
  • add a diagram of the client-server and multicast flow

About

Multithreaded client-server internet radio system in C using TCP, UDP multicast, and a custom application-layer protocol.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages