[go: up one dir, main page]

0% found this document useful (0 votes)
16 views16 pages

CN - Project Report AJ - SKB

This project report details the implementation of a Voice over Wi-Fi (Vo Wi-Fi) system using Java socket programming, focusing on a server-client architecture for real-time audio transmission. The system captures audio from a client's microphone, transmits it to a server, and plays it back, emphasizing key concepts such as socket programming, audio streaming, and concurrency. The project serves as a foundational demonstration of Vo Wi-Fi architecture, providing insights into networking principles and practical coding experience.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views16 pages

CN - Project Report AJ - SKB

This project report details the implementation of a Voice over Wi-Fi (Vo Wi-Fi) system using Java socket programming, focusing on a server-client architecture for real-time audio transmission. The system captures audio from a client's microphone, transmits it to a server, and plays it back, emphasizing key concepts such as socket programming, audio streaming, and concurrency. The project serves as a foundational demonstration of Vo Wi-Fi architecture, providing insights into networking principles and practical coding experience.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

External Project Report on

Computer Networking (CSE3034)

Voice Over Wi-Fi


(Vo Wi-Fi) System

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

B. Tech. CSE 5th Semester (Section W)

INSTITUTE OF TECHNICAL EDUCATION AND RESEARCH


(FACULTY OF ENGINEERING)
SIKSHA ‘O’ ANUSANDHAN (DEEMED TO BE UNIVERSITY), BHUBANESWAR,
ODISHA
Declaration
We, the undersigned students of B. Tech. of Computer Science and Engineering Department hereby
declare that we own the full responsibility for the information, results etc. provided in this PROJECT
titled “Voice over Wi-Fi(Vo Wi-Fi) System” submitted to Siksha ‘O’ Anusandhan (Deemed to be
University), Bhubaneswar for the partial fulfillment of the subject Computer Networking (CSE 3034).
We have taken care in all respect to honor the intellectual property right and have acknowledged
the contribution of othersfor using them in academic purpose and further declare that in case of any
violation of intellectual property right or copyright we, as the candidate(s), will be fully responsible for
the same.

SUBRAT KUMAR BEHERA APURBA PRIYADARSHINEE


Registration No.: 2141002065 Registration No.: 2141016342

SWEETA DAS SOUMYA RANJAN UPADHYAYA


Registration No.: 2141004007 Registration No.: 2141021005

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

Serial Chapter No. Title of the Chapter Page No.


No.

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

I. Explanation of the Problem:

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.

2. Audio Capture and Playback:

• 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.

• On the server side, the received audio should be played back.

3. Simple Socket Communication:

• Utilize basic socket programming in Java to establish communication between the


client and server.

• 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:

• Display relevant information in the console, such as connection status, data


transmission progress, and any errors that may occur.

• 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.

3. Audio Data Size:

• Consider constraints related to the size of audio data packets to optimize network
usage and prevent data loss.

4. User Input Validation:

• Implement proper validation for user inputs to handle potential errors gracefully.

5. Platform Compatibility:

• Ensure that the solution is platform-independent and can run on different


operating systems.

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:

1. Create a ServerSocket on a specified port to listen for incoming connections.

2. Accept incoming client connections using ServerSocket.accept().

3. Set up an audio playback stream on the server side.

4. Create a separate thread to handle audio playback concurrently.

5. Receive audio data from the connected client over the socket.

6. Play the received audio data using the audio playback stream.

7. Implement error handling and connection termination logic.

Client Side:

1. Create a Socket and connect to the server on the specified port.

2. Set up an audio capture stream on the client side to capture microphone input.

3. Create a separate thread to handle audio capture concurrently.

4. Read audio data from the capture stream.

5. Send the audio data to the server over the socket.

6. Implement error handling and connection termination logic.

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.

Basic Vo Wi-Fi Architecture:

1. Understand the flow of audio data from the client's microphone to the server's
playback.

2. Recognize the importance of concurrent execution for real-time audio streaming.

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:

1. Use ServerSocket to listen for incoming connections on the server.

2. Use Socket to connect to the server from the client.

3. Implement data transmission using InputStream and OutputStream.

4. Handle exceptions and errors related to socket communication.

5
4. Implementation
I. Program

Server code:

import javax.sound.sampled.*;

import java.io.*;

import java.net.*;

public class VoWiFiServer {

private static final int PORT = 5555;

public static void main(String[] args) {

try (ServerSocket serverSocket = new ServerSocket(PORT)) {

System.out.println("Server is listening on port " + PORT);

Socket clientSocket = serverSocket.accept();

System.out.println("Client connected: " + clientSocket.getInetAddress());

// Set up audio playback

AudioFormat audioFormat = new AudioFormat(8000.0f, 16, 1, true, false);

DataLine.Info dataLineInfo = new DataLine.Info(SourceDataLine.class, audioFormat);

SourceDataLine sourceDataLine = (SourceDataLine)


AudioSystem.getLine(dataLineInfo);

sourceDataLine.open(audioFormat);

sourceDataLine.start();

// Read and play incoming audio

InputStream inputStream = clientSocket.getInputStream();

byte[] buffer = new byte[1024];

int bytesRead;

while ((bytesRead = inputStream.read(buffer)) != -1) {

sourceDataLine.write(buffer, 0, bytesRead);

6
}

// Close resources

sourceDataLine.drain();

sourceDataLine.close();

clientSocket.close();

} catch (IOException | LineUnavailableException e) {

e.printStackTrace();

Client Code:

import javax.sound.sampled.*;

import java.io.*;

import java.net.*;

public class VoWiFiClient {

private static final String SERVER_IP = "localhost";

private static final int PORT = 5555;

public static void main(String[] args) {

try (Socket socket = new Socket(SERVER_IP, PORT)) {

// Set up audio capture

AudioFormat audioFormat = new AudioFormat(8000.0f, 16, 1, true, false);

DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, audioFormat);

TargetDataLine targetDataLine = (TargetDataLine)


AudioSystem.getLine(dataLineInfo);

targetDataLine.open(audioFormat);

targetDataLine.start();

System.out.println("Send captured audio to the server");

7
// Send captured audio to the server

OutputStream outputStream = socket.getOutputStream();

byte[] buffer = new byte[1024];

int bytesRead;

while (true) {

bytesRead = targetDataLine.read(buffer, 0, buffer.length);

outputStream.write(buffer, 0, bytesRead);

} catch (IOException | LineUnavailableException e) {

e.printStackTrace();

8
5. Results & Interpretation
Expected Output:

1. Server Output:

• The server should display "Server is listening on port 5555" upon successful
startup.

• When a client connects, it should print "Client connected: [client IP address]".

2. Client Output:

• The client should connect to the server and start capturing audio from the
microphone continuously.

Interpretation:

1. Server Side:

• The server will wait for a connection from the client.

• Once the client connects, it initializes audio playback and starts playing back any
received audio data.

2. Client Side:

• The client will connect to the server.

• 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.

• Ensure that the server is started before the client.

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:

• Server starts: "Server is listening on port 5555."

• A client connects: "Client connected: [client IP address]."

2. Client Side:

• Client connects: "Connected to server."

• Client continuously captures audio and sends it to the server.

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.

Furthermore, the implementation emphasized the simplicity of socket communication to


transmit audio data between the client and server over a specified port. While this example
serves as an educational foundation, it highlights key aspects of developing a basic Vo Wi-Fi
system, setting the stage for further exploration and enhancement of features such as error
handling, security, and scalability in more sophisticated implementations.

11
References

[1] Computer Networks, Andrew S. Tannenbaum, Pearson India.

[2] Java Network Programming by Harold, O’Reilly (Shroff Publishers).

12

You might also like