CN - Project Report AJ - SKB
CN - Project Report AJ - SKB
Submitted by
Name 01: SUBRAT KUMAR BEHERA Reg. No.: 2141002065
Name 02: APURBA PRIYADARSHINEE Reg. No.: 2141016342
Name 03: SWEETA DAS Reg. No.: 2141004007
Name 04: SOUMYA RANJAN UPADHYAYA Reg. No.: 2141021005
Name 05: ARPITA PATTANAIK Reg. No.: 2141016242
ARPITA PATTANAIK
Registration No.: 2141016242
DATA: 12/01/2024
PLACE: Siksha ‘O’ Anusandhan
ii
Abstract
This project introduces a comprehensive implementation of a Voice over Wi-Fi (Vo Wi-Fi)
system using Java socket programming. The architecture follows a robust server-client
model, where the server actively listens for incoming connections, and clients establish
connections for the seamless transmission of voice data over a local network. The project
aims to impart essential knowledge in socket programming, audio streaming, networking
fundamentals, and concurrency through the effective use of threads.
The system's core functionality involves capturing audio from the client's microphone,
enabling real-time transmission to the server. On the server side, the received audio is
played back, completing the loop of voice communication. The communication between the
client and server relies on fundamental socket programming concepts, emphasizing the
secure and efficient transfer of audio data over a specified port.
This endeavor not only provides hands-on experience in coding but also fosters a deep
understanding of networking principles, including server setup, client connection, and the
concurrent execution of server and client components through the implementation of
threads. As a practical application, the project serves as a foundational demonstration of a
Voice over Wi-Fi architecture within a single access point, offering insights into the
integration of audio streaming and socket communication in the Java programming
language.
iii
Contents
1
1. 1 Introduction
2-3
2. 2 Problem Statement
4-5
3. 3 Methodology
6-8
4. 4 Implementation
9 - 10
5. 5 Results and interpretation
11
6. 6 Conclusion
12
7. 7 References
iv
1. Introduction
Voice over Wi-Fi (Vo Wi-Fi) has become an integral part of modern communication systems,
enabling voice transmission over wireless networks. In this project, we aim to implement a
basic Vo Wi-Fi system within a single access point using Java socket programming. This
project will provide a hands-on experience in several key areas, including socket
programming, audio streaming, networking fundamentals, concurrency, and basic Vo Wi-Fi
architecture.
The primary goal is to establish a server-client architecture where the server listens for
incoming connections, and the client connects to the server for the transmission of voice
data. We will focus on capturing audio from the client's microphone, transmitting it over a
local network using sockets, and playing it back on the server side
Throughout the implementation, we will delve into socket programming concepts in Java,
gaining insights into how communication is established between a client and a server.
Additionally, we will explore the intricacies of audio streaming, understanding how to
capture and transmit audio data in a streaming fashion over the network.
Networking fundamentals will be covered as we set up the server, handle client connections,
and facilitate the seamless transmission of data over the local network. Concurrency will be
a key aspect of this project, as we employ threads to enable concurrent execution of both the
server and client components, allowing them to operate simultaneously.
By the end of this project, participants will have a solid grasp of the basic Vo Wi-Fi
architecture required for voice transmission within a single access point. This hands-on
experience will not only enhance their understanding of socket programming and
networking but also provide practical insights into audio streaming and concurrency in Java.
The project's features include a server-client architecture, audio capture and playback
capabilities, and simple socket communication for transmitting audio data between the
client and server over a specified port.
1
2. Problem Statement
Problem Statement: Implementing a Basic Voice over Wi-Fi (Vo Wi-Fi) System using Java
Socket Programming
In this project, we are tasked with developing a Voice over Wi-Fi (Vo Wi-Fi) system that
allows audio transmission from a client to a server using socket programming. The primary
goal is to capture audio from the client's microphone, transmit it over a local network to the
server, and play it back on the server side.
1. Server-Client Architecture:
• The system should have a server-client architecture where the server listens for
incoming connections, and the client connects to the server for voice transmission.
• On the client side, the program should capture audio from the microphone in real-
time.
• The captured audio should be transmitted to the server over the local network.
• Implement mechanisms for sending and receiving audio data over a specified port.
4. User Interaction:
• Allow the user to initiate the communication and specify the server's IP address
and port through the console.
2
5. Result Reflection:
• Save the received audio data into a file or database on the server side for future
reference.
II. Constraints:
1. Networking Constraints:
• Ensure the program works within the confines of a local network. External internet
communication is not required for this project.
2. Concurrency Constraints:
• Implement concurrent execution using threads to allow the server and client
components to operate simultaneously.
• Consider constraints related to the size of audio data packets to optimize network
usage and prevent data loss.
• Implement proper validation for user inputs to handle potential errors gracefully.
5. Platform Compatibility:
By addressing these constraints and implementing the specified features, we will create a
functional Vo Wi-Fi system that demonstrates key concepts in socket programming, audio
streaming, networking fundamentals, and concurrency using Java.
3
3. Methodology
Algorithm for implementing a basic Voice over Wi-Fi (VoWi-Fi) system within a single
access point using socket programming in Java:
Server Side:
5. Receive audio data from the connected client over the socket.
6. Play the received audio data using the audio playback stream.
Client Side:
2. Set up an audio capture stream on the client side to capture microphone input.
Concurrency:
1. Use Java's threading mechanism to enable concurrent execution of audio capture and
playback on both the client and server sides.
2. Ensure proper synchronization to avoid race conditions and ensure data consistency.
1. Understand the flow of audio data from the client's microphone to the server's
playback.
4
3. Comprehend the client-server communication model for VoWi-Fi.
Networking Fundamentals:
1. Gain a basic understanding of ServerSocket and Socket classes in Java for server-client
communication.
2. Learn how to establish connections, transmit data, and handle errors in a networked
environment.
Audio Streaming:
1. Set up audio capture and playback streams on both client and server sides.
2. Understand the streaming nature of audio data transmission over the network.
Socket Programming:
5
4. Implementation
I. Program
Server code:
import javax.sound.sampled.*;
import java.io.*;
import java.net.*;
sourceDataLine.open(audioFormat);
sourceDataLine.start();
int bytesRead;
sourceDataLine.write(buffer, 0, bytesRead);
6
}
// Close resources
sourceDataLine.drain();
sourceDataLine.close();
clientSocket.close();
e.printStackTrace();
Client Code:
import javax.sound.sampled.*;
import java.io.*;
import java.net.*;
targetDataLine.open(audioFormat);
targetDataLine.start();
7
// Send captured audio to the server
int bytesRead;
while (true) {
outputStream.write(buffer, 0, bytesRead);
e.printStackTrace();
8
5. Results & Interpretation
Expected Output:
1. Server Output:
• The server should display "Server is listening on port 5555" upon successful
startup.
2. Client Output:
• The client should connect to the server and start capturing audio from the
microphone continuously.
Interpretation:
1. Server Side:
• Once the client connects, it initializes audio playback and starts playing back any
received audio data.
2. Client Side:
• It continuously captures audio from the microphone and sends it to the server.
Troubleshooting:
• If there are issues, check for error messages in the console output.
9
• Make sure that your system has the necessary audio devices and permissions for
microphone and speaker access.
• If running the server and client on different machines, replace "localhost" in the client
code with the IP address of the server machine.
Potential Enhancements:
• This example is very basic and doesn't include error handling, security measures, or
advanced features needed for a production-level system.
• You might need to adjust the code based on your specific audio setup or network
configuration.
Example Interaction:
1. Server Side:
2. Client Side:
3. Observation:
• As you speak into the microphone on the client side, you should hear the audio
played back on the server side.
10
6. Conclusion
The implemented basic Voice over Wi-Fi (Vo Wi-Fi) system using Java socket programming
successfully demonstrated fundamental concepts in various domains. The project
incorporated essential elements, including socket programming for client-server
communication, audio streaming for capturing and transmitting audio data, and networking
fundamentals for setting up a local network connection.
The use of threads provided concurrency, allowing the server and client components to
operate simultaneously. This concurrency is crucial for real-time applications like Vo Wi-Fi,
where capturing and transmitting audio must occur concurrently.
The system's architecture adhered to basic Vo Wi-Fi principles within a single access point.
The server-client architecture facilitated communication, and the integration of audio capture
and playback functionalities showcased the transmission of voice data over the local network.
11
References
12