0% found this document useful (0 votes)
4 views17 pages

CN Project 3 Report On Computer Networks

The document presents the 'Network Desktop Manager,' a Java-based application designed for efficient communication and administration within a Local Area Network (LAN). It features a user-friendly GUI, remote operations like desktop and file sharing, and allows network administrators to monitor and manage client desktops effectively. The project aims to address the challenges of centralized administration and user interaction within LAN systems, ensuring platform independence and practical implementation of network functionalities.

Uploaded by

mardiblbiswajit
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)
4 views17 pages

CN Project 3 Report On Computer Networks

The document presents the 'Network Desktop Manager,' a Java-based application designed for efficient communication and administration within a Local Area Network (LAN). It features a user-friendly GUI, remote operations like desktop and file sharing, and allows network administrators to monitor and manage client desktops effectively. The project aims to address the challenges of centralized administration and user interaction within LAN systems, ensuring platform independence and practical implementation of network functionalities.

Uploaded by

mardiblbiswajit
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/ 17

External Project Report on

Computer Networking (CSE3034)

Network Desktop
Manager

Submitted by
Arnab Banerjee Reg. No.: 2141002018
Abhishek Bhatta Reg. No.: 2141002088
Badal Kumar Mohapatra Reg. No.: 2141013261
Abhishek Jyethi Reg. No.: 2141010069

B. Tech. BRANCH 5th Semester (Section - 2141018 )

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 CSE Department hereby declare that we own the full
responsibility for the information, results etc. provided in this PROJECT titled “Network Desktop
Manager” 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 others
for 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.

Arnab Banerjee Abhishek Bhatta

Registration No.: 2141002018 Registration No.: 2141002088

Badal Kumar Mohapatra Abhishek Jyethi

Registration No.: 2141013261 Registration No.:2141010069

DATE: 12th January 2024


PLACE: Bhubaneswar

ii
Abstract

 The Network Desktop Manager is a Java-based application designed to


facilitate communication and administration within a Local Area Network
(LAN) system. This project incorporates a Graphical User Interface (GUI)
for user interactions, Socket Programming for seamless communication
between computers, and features for network administration tasks.
 The Network Administrator plays a crucial role in this system, having
access to configuration settings on client desktops to monitor the reception
of updates. Additionally, the administrator can perform remote operations
like desktop sharing and file sharing, enhancing the overall network
management capabilities.
 The User Interface (UI) is designed to be simple and intuitive, allowing
users to interact with both the server and client components. Clients can
initiate requests for help, while the server can perform various operations
such as creating folders, renaming files, and other administrative tasks.
 This project provides a practical implementation of network
communication, user interface design, and network administration
functionalities, making it a valuable tool for managing LAN systems
effectively. The use of Java ensures platform independence, making it
suitable for a variety of operating environments.

iii
Contents

Serial Chapter No. Title of the Chapter Page No.


No.

1. 1 Introduction 1

2. 2 Problem Statement 2

3. 3 Methodology 3-4

4. 4 Implementation 5 - 10

5. 5 Results and interpretation 11

6. 6 Conclusion 12

7. References 13

iv
1. Introduction

 The Network Desktop Manager is a comprehensive Java-based solution designed to


facilitate efficient communication and administration within a Local Area Network
(LAN) environment. This project addresses the need for a seamless and user-friendly
platform that allows network administrators to monitor and manage client desktops.
 The primary focus is on creating a robust system that incorporates Graphical User
Interfaces (GUIs) for user interactions, Socket Programming for network
communication, and essential features for network administration.
 In today's dynamic business and educational environments, the ability to efficiently
manage and communicate across multiple computers within a local network is
paramount. The Network Desktop Manager aims to streamline these operations by
providing a centralized system where administrators can monitor client desktops,
perform remote administrative tasks, and users can easily request assistance.
The core features of the Network Desktop Manager include:
1. Network Administrator Access:
 Enables network administrators to access and configure settings on client
desktops.
 Facilitates monitoring of update reception on client machines.
2. Remote Admin Operations:
 Empowers administrators to conduct desktop sharing, file sharing, and other
remote operations.
 Enhances the network administrator's ability to troubleshoot and assist users.
3. User Interface:
 Implements a user-friendly GUI for both server and client components.
 Simplifies user interactions, allowing clients to request help and administrators
to perform various operations on the network.
This project is not only focused on functionality but also on the practical implementation of
Java-based technologies. Leveraging the power of Java ensures platform independence,
making the Network Desktop Manager versatile and applicable across diverse operating
environments. The subsequent sections will delve into the project's architecture, design
considerations, and the implementation details of the various components that make up the
Network Desktop Manager.

1
2.Problem Statement

I. Explanation of the Problem:


1. Lack of Centralized Administration:
 Current LAN systems often lack a centralized platform for administrators to
efficiently monitor and manage client desktops.
2. Limited Remote Assistance:
 There is a need for a system that allows network administrators to perform
remote operations like desktop sharing and file sharing to aid users effectively.
3. Complexity in User Interaction:
 The absence of a simplified user interface hampers user interactions within the
LAN, making it challenging for users to request help and for administrators to
respond promptly.
Console Input and Output:
 Element/Object to be Entered by User:
 For the client, users can initiate requests for help through the console by
specifying their needs or issues.
 For the network administrator, various commands related to remote operations,
monitoring, and administration can be entered through the console.
 Result Reflected in Console/File/Database:
 The console output will display feedback on the status of the requests or
operations initiated by the users or administrators.
 Additionally, for administrative tasks, the changes in the configuration settings
or the results of remote operations will be reflected in the console.
II. Constraints:
1. Network Connectivity:
 The system relies on stable network connectivity. Any disruptions may impact
the effectiveness of remote operations and communication.
2. Security Concerns:
 Implementing remote desktop sharing and file sharing requires robust security
measures to protect sensitive data from unauthorized access.
3. Platform Independence:
 The project aims for platform independence, but certain constraints may arise
based on the diversity of operating systems and configurations within the LAN.
4. User Permissions:
 Users and administrators must have appropriate permissions to ensure that the
initiated requests and operations are carried out successfully without
compromising system integrity.
5. Scalability:
 The system should be designed to handle varying scales of LANs, ensuring
scalability without compromising performance.

2
3.Methodology
Client Algorithm:

1. Class Definition:
 Define a class NetworkDesktopManagerClient that extends JFrame and implements the
ActionListener interface.
2. Constants:
 Declare a constant PORT with the port number on which the client will connect to the server.
3. Instance Variables:
 Declare instance variables for the client socket (clientSocket), input stream (input), output
stream (output), text area (chatArea), text field (chatField), and buttons (fileButton,
desktopButton).
 Declare a boolean variable sharingDesktop to control desktop sharing.
4. Constructor:
 In the constructor NetworkDesktopManagerClient() throws IOException:
 Call the superclass constructor with the window title.
 Set the layout to BorderLayout.
 Initialize and configure GUI components (text area, text field, buttons).
 Establish a connection to the server using a socket (clientSocket).
 Initialize input and output streams (input, output).
 Display a message indicating a successful connection.
5. ActionListener Implementation:
 Implement the actionPerformed method:
 If the source is fileButton, call the sendFiles method.
 If the source is desktopButton, call the sendDesktop method.
6. sendFiles Method:
 Implement the sendFiles method:
 Use a JFileChooser to allow the user to select multiple files.
 Send the number of files to the server.
 For each selected file:
 Send the file size.
 Read the file content and send it in chunks.
7. sendDesktop Method:
 Implement the sendDesktop method:
 Get the desktop resolution using Toolkit.
 Create a Robot object to capture the desktop.
 Capture the desktop image using createScreenCapture.
 Convert the BufferedImage to a byte array.
 Break the byte array into smaller packets and send them to the server.
8. Main Method:
 Implement the main method:
 Create an instance of NetworkDesktopManagerClient in a try-catch block.
 Handle IOException by printing the stack trace.
9. Adjustments:
 Uncomment the code related to the sendButton if you want to enable sending text messages.
 Adjust the packet size in the sendDesktop method based on your network condition

3
Server algorithm:

1. Class Definition:
 Define a class NetworkDesktopManagerServer that extends JFrame and implements the
ActionListener interface.
2. Constants:
 Declare a constant PORT with the port number on which the server will listen for
connections.
3. Instance Variables:
 Declare instance variables for the server socket (serverSocket), client socket (clientSocket),
input stream (input), output stream (output), text area (chatArea), text field (chatField), and
buttons (fileButton, desktopButton).
4. Constructor:
 In the constructor NetworkDesktopManagerServer() throws IOException:
 Call the superclass constructor with the window title.
 Set the layout to BorderLayout.
 Initialize and configure GUI components (text area, text field, buttons).
 Create a server socket and wait for a client to connect.
 Initialize input and output streams (input, output) once the client is connected.
 Display a message indicating a successful client connection.
5. ActionListener Implementation:
 Implement the actionPerformed method:
 If the source is fileButton, call the receiveFiles method.
 If the source is desktopButton, call the receiveDesktop method.
6. receiveFiles Method:
 Implement the receiveFiles method:
 Read the number of files being sent by the client.
 For each file:
 Read the file size and create a FileOutputStream for the received file.
 Read and write the file content in chunks until the entire file is received.
 Close the FileOutputStream.
 Display a message indicating the successful receipt of the file.
7. receiveDesktop Method:
 Implement the receiveDesktop method:
 Read the number of packets from the client.
 Create a ByteArrayOutputStream to accumulate the desktop image data.
 Loop through the packets:
 Read a packet of image data and write it to the ByteArrayOutputStream.
 Convert the accumulated byte array to a BufferedImage.
 Display the desktop image in a new JFrame with a JLabel.
 Display a message indicating the successful receipt of the desktop image.
8. Main Method:
 Implement the main method:
 Create an instance of NetworkDesktopManagerServer in a try-catch block.
 Handle IOException by printing the stack trace.

4
4
4. Implementation
Client code:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;
import javax.swing.*;

public class NetworkDesktopManagerClient extends JFrame implements ActionListener {

private static final int PORT = 1234;

private Socket clientSocket;


private DataInputStream input;
private DataOutputStream output;
private JTextArea chatArea;
private JTextField chatField;
private JButton sendButton;
private JButton fileButton;
private JButton desktopButton;
private boolean sharingDesktop; // Flag to control desktop sharing

public NetworkDesktopManagerClient() throws IOException {


super("Network Desktop Manager Client");
setLayout(new BorderLayout());
chatArea = new JTextArea();
chatArea.setEditable(false);
add(new JScrollPane(chatArea), BorderLayout.CENTER);
chatField = new JTextField();
add(chatField, BorderLayout.SOUTH);
/*
sendButton = new JButton("Send");
sendButton.addActionListener(this);
add(sendButton, BorderLayout.EAST);
*/
fileButton = new JButton("Send File");
fileButton.addActionListener(this);
add(fileButton, BorderLayout.WEST);
desktopButton = new JButton("Share Desktop");
desktopButton.addActionListener(this);
add(desktopButton, BorderLayout.NORTH);
pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Connect to the server


clientSocket = new Socket("192.168.60.212", PORT); // Replace with the server IP address
input = new DataInputStream(clientSocket.getInputStream());
output = new DataOutputStream(clientSocket.getOutputStream());
chatArea.append("Connected to server!\n");
}

4
5
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == sendButton) {
String message = chatField.getText();
try {
output.writeUTF(message);
chatArea.append("You: " + message + "\n");
} catch (IOException ex) {
chatArea.append("Error sending message: " + ex.getMessage() + "\n");
}
chatField.setText("");
} else if (e.getSource() == fileButton) {
sendFiles(); // Updated method name
} else if (e.getSource() == desktopButton) {
sendDesktop();
}
}

private void sendFiles() {


JFileChooser fileChooser = new JFileChooser();
fileChooser.setMultiSelectionEnabled(true); // Allow multiple files to be selected
int result = fileChooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File[] selectedFiles = fileChooser.getSelectedFiles();
try {
// Send the number of files being sent
output.writeInt(selectedFiles.length);

for (File file : selectedFiles) {


// Send file size
long fileSize = file.length();
output.writeLong(fileSize);

// Send file contents


FileInputStream fileInputStream = new FileInputStream(file);
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = fileInputStream.read(buffer)) != -1) {
output.write(buffer, 0, bytesRead);
}
fileInputStream.close();
chatArea.append("File '" + file.getName() + "' sent successfully!\n");
}
} catch (IOException ex) {
chatArea.append("Error sending files: " + ex.getMessage() + "\n");
}
}
}

private void sendDesktop() {


try {
// Get the desktop resolution
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int width = screenSize.width;
4
6
int height = screenSize.height;

// Create a Robot object to capture the desktop


Robot robot = new Robot();

// Create a BufferedImage to store the desktop image


BufferedImage desktopImage = robot.createScreenCapture(new Rectangle(0, 0, width, height));

// Convert the BufferedImage to a byte array


ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(desktopImage, "png", baos);
byte[] desktopBytes = baos.toByteArray();

// Break the image into smaller packets and send them in a loop
int packetSize = 1024; // Adjust this value based on your network conditions
int numPackets = (int) Math.ceil((double) desktopBytes.length / packetSize);
output.writeInt(numPackets); // Send the number of packets

for (int i = 0; i < numPackets; i++) {


byte[] packet = new byte[packetSize];
System.arraycopy(desktopBytes, i * packetSize, packet, 0, Math.min(packetSize, desktopBytes.length - i *
packetSize));
output.write(packet); // Send the packet

chatArea.append("Desktop image sent successfully!\n");


} catch (IOException | AWTException ex) {
chatArea.append("Error sending desktop: " + ex.getMessage() + "\n");
}
}

public static void main(String[] args) {


try {
new NetworkDesktopManagerClient();
} catch (IOException e) {
e.printStackTrace();
}
}
}

7
7
Server code:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;
import javax.swing.*;

public class NetworkDesktopManagerServer extends JFrame implements ActionListener {

private static final int PORT = 1234;

private ServerSocket serverSocket;


private Socket clientSocket;
private DataInputStream input;
private DataOutputStream output;
private JTextArea chatArea;
private JTextField chatField;
private JButton sendButton;
private JButton fileButton;
private JButton desktopButton;

public NetworkDesktopManagerServer() throws IOException {


super("Network Desktop Manager Server");
setLayout(new BorderLayout());

chatArea = new JTextArea();


chatArea.setEditable(false);
add(new JScrollPane(chatArea), BorderLayout.CENTER);

chatField = new JTextField();


add(chatField, BorderLayout.SOUTH);
/*
sendButton = new JButton("Send");
sendButton.addActionListener(this);
add(sendButton, BorderLayout.EAST);
*/
fileButton = new JButton("Receive File");
fileButton.addActionListener(this);
add(fileButton, BorderLayout.WEST);

desktopButton = new JButton("Receive Desktop");


desktopButton.addActionListener(this);
add(desktopButton, BorderLayout.NORTH);

pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

serverSocket = new ServerSocket(PORT);


chatArea.append("Waiting for client to connect...\n");

8
8
// Accept client connection
clientSocket = serverSocket.accept();
chatArea.append("Client connected");
input = new DataInputStream(clientSocket.getInputStream());
output = new DataOutputStream(clientSocket.getOutputStream());
}

@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == sendButton) {
String message = chatField.getText();
try {
output.writeUTF(message);
chatArea.append("Server: " + message + "\n");
} catch (IOException ex) {
chatArea.append("Error sending message: " + ex.getMessage() + "\n");
}
chatField.setText("");
} else if (e.getSource() == fileButton) {
receiveFiles();
} else if (e.getSource() == desktopButton) {
receiveDesktop();
}
}

private void receiveFiles() {


try {
int numFiles = input.readInt(); // Read the number of files being sent
for (int i = 0; i < numFiles; i++) {
long fileSize = input.readLong();
byte[] buffer = new byte[4096];
FileOutputStream fileOutputStream = new FileOutputStream("received_file_" + i + ".txt");
int bytesRead;
while (fileSize > 0 && (bytesRead = input.read(buffer, 0, (int) Math.min(buffer.length, fileSize))) != -1) {
fileOutputStream.write(buffer, 0, bytesRead);
fileSize -= bytesRead;
}
fileOutputStream.close();
chatArea.append("File " + i + " received successfully!\n");
}
} catch (IOException ex) {
chatArea.append("Error receiving files: " + ex.getMessage() + "\n");
}
}

// Implement the method for receiving desktop here


private void receiveDesktop() {
try {
int numPackets = input.readInt(); // Receive the number of packets

ByteArrayOutputStream baos = new ByteArrayOutputStream();

for (int i = 0; i < numPackets; i++) {


byte[] packet = new byte[1024]; // Adjust this value based on the packet size used by the client
9
9
int bytesRead = input.read(packet); // Read a packet of image data
baos.write(packet, 0, bytesRead); // Write the received bytes to the output stream
}

byte[] desktopBytes = baos.toByteArray();


ByteArrayInputStream bais = new ByteArrayInputStream(desktopBytes);
BufferedImage desktopImage = ImageIO.read(bais);

// Display the desktop image in a new window


JFrame imageFrame = new JFrame("Received Desktop Image");
JLabel imageLabel = new JLabel(new ImageIcon(desktopImage));
imageFrame.getContentPane().add(imageLabel);
imageFrame.pack();
imageFrame.setVisible(true);

chatArea.append("Desktop image received successfully!\n");


} catch (IOException ex) {
chatArea.append("Error receiving desktop: " + ex.getMessage() + "\n");
}
}

public static void main(String[] args) {


try {
new NetworkDesktopManagerServer();
} catch (IOException e) {
e.printStackTrace();
}
}
}

10
10
Results & Interpretation

Server side:

Client side:

11

11
Conclusion

 In conclusion, the Network Desktop Manager project represents a


significant step towards addressing the challenges associated with
communication and administration in Local Area Network (LAN) systems.
By providing a centralized platform with a user-friendly Graphical User
Interface (GUI), robust Socket Programming for network communication,
and essential features for network administration, the project aims to
streamline operations and enhance efficiency within LAN environments.
 The project acknowledges the current gaps in LAN administration, such as
the lack of centralized control, limited remote assistance capabilities, and
complexities in user interactions. Through the implementation of the
Network Desktop Manager, these issues are systematically addressed,
providing solutions that bridge the gaps between administrators and users
within the LAN.
 The introduction of a simplified console interface empowers users to
request help and allows administrators to perform various remote
operations seamlessly. The constraints, including network connectivity,
security concerns, platform independence, user permissions, and scalability,
are considered and approached with the intention of creating a robust and
secure system.
 In essence, the Network Desktop Manager offers a holistic solution that not
only addresses the identified problems but also lays the foundation for
efficient LAN management, enabling administrators to monitor, assist, and
perform remote operations seamlessly. As technology evolves, solutions
like the Network Desktop Manager become essential in ensuring the
smooth operation of LAN systems in various professional and educational
settings.

12
1
References
(as per the IEEE recommendations)

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

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

[3] https://www.oracle.com/in/java/

13
1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy