CG Report
CG Report
CHAPTER 1
INTRODUCTION
In today’s era of the internet majority of the communications happens through the client-server
architecture model. All online transactions such as browsing the web, shopping on e-commerce
portals, online banking transactions, etc are made possible through communication between the
client i.e. the user of a service and the server. This process of communication is not as simple as
explained above.
Clients and servers exchange messages in a request–response messaging pattern. The client
initiates a request to the server and the server returns a response. This exchange of messages is an
example of interprocess communication. To start the actual communication between the client and
server, first a connection has to be established between the client and server through an interface
called socket. Once the connection is set up, the client and server exchange messages through this
socket. To communicate, the computers must have a common language, and they must follow
rules so that both the client and the server know what to expect. The language and rules of
communication are defined in a communications protocol.
The exchange of messages between the client and server is in the form of data packets . Bytes are
grouped together to form a data packet. Apart from the actual message the data packets also contain
additional information such as source and destination address, protocol and its version, error
control information, etc. This architecture allows for efficient data management and resource
allocation by centralizing critical functions on the server, which can handle complex processing
and large-scale data storage.
Clients manage user interactions and send specific requests to the server, which processes these
requests and sends back appropriate responses. The client-server architecture is highly scalable,
as it can accommodate more clients by scaling the server’s capabilities or adding additional
servers. This design is prevalent in various applications, including web services, database
management, and email systems, providing a robust framework for developing and managing
complex, distributed systems efficiently.
Client: The client is a device or application that requests services or resources from the
server. It initiates communication with the server and processes the results returned by the
server.
Server: The server is a powerful machine or application that provides services or resources
to clients. It processes client requests, performs the necessary computations or data retrieval,
and sends back the appropriate responses.
Network: The network facilitates communication between clients and servers. It enables
data exchange using various protocols and ensures reliable connectivity.
Protocols: Protocols are standardized rules that govern data transmission and
communication between clients and servers. They ensure that data is transmitted in a secure,
reliable, and understood manner.
Database: A database is a structured collection of data stored on the server. It stores and
manages data that clients request, ensuring data consistency, integrity, and security.
User Interface (UI): The UI is the part of the client application that interacts with the user.
It provides a means for users to input data and view results returned by the server.
Application Logic: Application logic refers to the code and algorithms that define the
application’s functionality. It processes user inputs, interacts with the server, and manages
the flow of data between the client and the server
1.1 OBJECTIVES
1. Resource Sharing: Efficiently share resources such as graphics processing units (GPUs), data,
2. Scalability: Enable the system to handle an increasing number of clients and workloads
4. Cost Efficiency: Reduce costs by consolidating hardware and software resources, allowing
server-side hardware, improving performance for clients with less powerful hardware.
6. Security: Centralize security measures to protect data, applications, and resources, and control
9. Data Consistency: Ensure data consistency and integrity by maintaining a single source of
10. Load Balancing: Distribute workloads across multiple servers to optimize resource utilization
1.2 SCOPE :
The existing system of displaying a simulated system of client server simulations has always been
flawed because of its inability to display a simulated GUI. It has always been unable to convey a
convincing display about the packet transfer and the receiving party and also to know where the
packets and data is being sent to the server.
Our system covers the existing in the way that only the necessary and essential transfers are noted
and also the actual details of the packets being sent are noted. This will help a person understand
what is happening in a network without understanding the technical details in the network. This
system can be used for educational purposes to teach and explain the working of client and server
and network programming.
1.3 STATEMENT :
The aim of the simulation is to provide a graphical interface to a user to show how exactly client
server simulation in a network happens. This should allow the user to understand how exactly
communication happens between client server in a network. So the user should be able see how
the commands are sent from client to server and how the responses happen. The user should
understand how the packets in a network travel from the Client to the Server. The various functions
such as retrieve, store and list should also be visualised in real time.
1.4 LIMITATION :
Our system provides insight into data being sent across client and server and how exactly
communication happens. While the packet transfer to the different components of the client and
server is shown, this does not show what exactly is contained inside the packets and how the
packets are routed. It does not explain how the data is encapsulated inside a data packet or what
exactly the commands are and the internet protocol used is also left unexplained for now.
CHAPTER 2
LITERATURE SURVEY
Graphics provides one of the most natural means of communicating within a computer, since our
highly developed 2D and 3D pattern-recognition abilities allow us to perceive process pictorial
data rapidly and effectively. Interactive computer graphics is the most important means of
producing pictures since the invention of photography and television. It has the added advantage
that, with the computer, we can make pictures not only of concrete real world objects but also of
abstract, synthetic objects, such as mathematical surfaces and of data that have no inherent
geometry, such as survey results. Computer graphics started with the display of data on hardcopy
plotters and cathode ray tube screens soon after the introduction of computers themselves. It has
grown to include the creation, storage, and manipulation of models and images of objects. These
models come from a diverse and expanding set of fields, and include physical, mathematical,
engineering, architectural, and even conceptual structures, natural phenomena, and so on.
Computer graphics today is largely interactive. The user controls the contents, structure, and
appearance of the objects and of their displayed images by using input devices, such as keyboard,
mouse, or touch-screen. Due to close relationships between the input devices and the display, the
handling of such devices is included in the study of computer graphics. The advantages of the
interactive graphics are many in number. Graphics provides one of the most natural means of
communicating with a computer, since our highly developed 2D and 3D patter-recognition abilities
allow us to perceive and process data rapidly and efficiently. In many design, implementation, and
construction processes today, the information pictures can give is virtually indispensable.
Scientific visualization became an important field in the 1980s when the scientists and engineers
realized that they could not interpret the prodigious quantities of data produced in supercomputer
runs without summarizing the data and highlighting trends and phenomena in various kinds of
graphical representations.
Main GL: Library has names that begin with the letter gl and are stored in a library usually
referred to as GL.
OpenGL Utility Library (GLU): This library uses only GL functions but contains code
for creating common objects and simplifying viewing.
OpenGL Utility Toolkit (GLUT): This provides the minimum functionality that should
be accepted in any modern windowing system.
OpenGL (Open Graphics Library) is the interface between a graphic program and graphics
hardware. It is streamlined. In other words, it provides low-level functionality. For
example, all objects are built from points, lines and convex polygons. Higher level objects
like cubes are implemented as six four-sided polygons.
OpenGL supports features like 3-dimensions, lighting, anti-aliasing, shadows, textures,
depth effects, etc.
It is system-independent. It does not assume anything about hardware or operating system
and is only concerned with efficiently rendering mathematically described scenes. As a
result, it does not provide any windowing capabilities.
It is a state machine. At any moment during the execution of a program there is a current
model transformation.
It is a rendering pipeline. The rendering pipeline consists of the following steps: o Defines
objects mathematically.
Graphics provides one of the most natural means of communicating with a computer, since our
highly developed 2D and 3D pattern-recognition abilities allow us to perceive and process pictorial
data rapidly and efficiently. Interactive computer graphics is the most important means of
producing pictures since the invention of photography and television. It has the added advantage
that, with the computer, we can make pictures not only of concrete real world objects but also of
abstract, synthetic objects, such as mathematical surfaces and of data that have no inherent
geometry, such as survey results.
OpenGL (open graphics library) is a standard specification defining a cross language cross
platform API for writing applications that produce 2D and 3D computer graphics. OpenGL was
developed by silicon graphics Inc. (SGI) in 1992 and is widely used in CAD, virtual reality,
scientific visualization, information visualization and flight simulation. It is also used in video
games.
OpenGL has historically been influential on the development of 3D accelerator, promoting a base
level of functionality that is now common in consumer level hardware:
Z buffering.
Clients and servers exchange messages in a request–response messaging pattern. The client sends
a request, and the server returns a response. This exchange of messages is an example of inter-
process communication. To communicate, the computers must have a common language, and they
must follow rules so that both the client and the server know what to expect. The language and
rules of communication are defined in a communications protocol. All client-server protocols
operate in the application layer. The application layer protocol defines the basic patterns of the
dialogue. To formalize the data exchange even further, the server may implement an application
programming interface (API). The API is an abstraction layer for accessing a service. By restricting
communication to a specific content format, it facilitates parsing. By abstracting access, it
facilitates cross-platform data exchange.
A server may receive requests from many distinct clients in a short period of time. A computer can
only perform a limited number of tasks at any moment, and relies on a scheduling system to
prioritize incoming requests from clients to accommodate them. To prevent abuse and maximize
availability, server software may limit the availability to clients. Denial of service attacks are
designed to exploit a server's obligation to process requests by overloading it with excessive
request rates.
The client–server model does not dictate that server-hosts must have more resources than client-
hosts. Rather, it enables any general-purpose computer to extend its capabilities by using the shared
resources of other hosts. Centralized computing, however, specifically allocates a large amount of
resources to a small number of computers. The more computation is offloaded from client-hosts
to the central computers, the simpler the client-hosts can be.
CHAPTER 3
REQUIREMENT SPECIFICATIONS
Processor: Any modern CPU, including low-end processors like Intel Celeron or AMD
Athlon.
RAM: 1 GB or more.
Storage: Minimal storage space, typically less than 100 MB.
Display: A basic screen with a minimum resolution of 800x600 pixels.
Input Device: Keyboard and mouse or touch screen.
This client server architecture has been designed for WINDOWS. OpenGL libraries are used and
hence Eclipse is required.
Language : C++
Tool : Eclipse
Library : OpenGL
CHAPTER 4
SYSTEM ANALYSIS
Architecture Components
Clients: Devices or applications requesting services, often with a graphical user interface
(GUI) for user interaction.
Servers: Centralized systems providing resources, services, or data processing capabilities.
Network: The medium enabling communication between clients and servers, often the
internet or a local area network (LAN).
Communication Protocols
Request/Response Model: Clients send requests for resources or data, and servers respond
with the required information.
State Management: Handling sessions and maintaining state information across multiple
interactions.
Data Input: Clients capture user inputs or data, which are sent to the server for processing.
Data Processing: Servers handle intensive computations, rendering tasks, and data
manipulations.
Performance Analysis
Latency: Measure the time taken for data to travel between clients and servers, including
network delays and processing times.
Throughput: Evaluate the amount of data processed and transmitted within a given
timeframe.
Load Balancing: Assess mechanisms for distributing workloads across multiple servers
to prevent bottlenecks.
Scalability
Security
Authentication and Authorization: Ensuring only authorized clients can access server
resources.
Encryption: Protecting data in transit between clients and servers.
Firewalls and Intrusion Detection: Safeguarding servers from unauthorized access and
cyber threats.
User Experience
Responsiveness: Ensuring quick feedback and minimal lag for client interactions.
Consistency: Providing a uniform experience across different clients and sessions.
By analyzing these aspects, one can design, implement, and maintain a robust and efficient client-
server architecture tailored to the specific needs of computer graphics applications.
CHAPTER 5
DESIGN
Client Tier: User devices (PCs, tablets, smartphones) running the client application.
Server Tier: Centralized servers providing rendering, data management, and other services.
Network Tier: The communication layer connecting clients to servers, typically via the
internet or a local area network (LAN).
Client Components
User Interface (UI): Graphical User Interface (GUI) for user interaction. Input handling
for user commands, gestures, and interactions.
Networking Module: Handles communication with the server using protocols like HTTP,
WebSockets, or custom protocols. Manages request/response cycles, including error
handling and retries.
Rendering Engine: Local rendering for simple tasks or pre-visualization. Receives
rendered frames from the server for display.
Data Management: Local caching of data for offline access and reduced latency.
Synchronization with server data.
Server Components
Application Server: Manages client requests and overall application logic. Handles user
authentication, session management, and authorization.
Rendering Server: Dedicated server or cluster for high-performance rendering tasks.
Utilizes GPUs and specialized hardware for efficient rendering.
Data Server: Stores and manages user data, graphical assets, and project files. Implements
database management systems (DBMS) for structured data storage.
Collaboration Server: Manages real-time collaboration features, such as shared
workspaces and version control. Supports communication tools like chat and annotations.
Network Design
The system consists of a client and server which send commands over a network and a resulting
handshaking occurs. After a handshake there is an exchange of packets that occurs.
The client and server consist of several functions before handshaking, these functions determine
the connections and the commands sent between the client and server.
The client server typically follows the TCP/IP model where the socket is above the transport layer
in both client and server. This helps in sending commands over a network.
CHAPTER 6
IMPLEMENTATION
This project is implemented using C++ as the programming language. The graphics library used
is OpenGL. Integrated Development Environment (IDE) used is Eclipse.
OpenGL :
Eclipse :
Eclipse is a free, open-source cross-platform IDE that supports multiple compilers including GCC
and Visual C++. It is developed in C++ using Widgets as the Graphical User Interface(GUI)
toolkit. Using a plugin architecture, its capabilities and features are defined by the provided
plugins. Currently, Eclipse is oriented towards C, C++ .
RETRIVE –
The client sends a retrieve command (RETR) to the server to retrieve or fetch a data or file it
wants. The server responds back to the client by sending the data packet requested by it.
STORE –
When the client wants to store some data in the server it sends STR command to the server. This
lets the server know that the data it receives has to be saved. Then the client sends the data to be
stored as a data packet to the server, the server on receiving it saves it as it knows it has to be
saved.
LIST –
When the client wants to know to information about its data stored in the server, it sends a LIST
command to the server. The server responds with the list data packets of the client that it has
been stored.
EXIT –
This exits and closes the client – server simulation running.
CHAPTER 7
TESTING
Testing a client-server architecture in computer graphics using OpenGL involves multiple steps to
ensure that the client can send data to the server, the server can process this data, and then send
the appropriate response back to the client. Here's a simple example in C++ using OpenGL for the
graphics part and sockets for the networking part.
The server will listen for connections from clients and respond with some data. Here's a basic
example:
#include <iostream>
#include <cstring>
#include <unistd.h>
#include <netinet/in.h>
int main() {
int server_fd, new_socket;
struct sockaddr_in address;
int addrlen = sizeof(address);
char buffer[1024] = {0};
const char *hello = "Hello from server";
exit(EXIT_FAILURE);
}
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(PORT);
std::cout << "Message from client: " << buffer << std::endl;
close(new_socket);
close(server_fd);
return 0;
}
The client will connect to the server, send some data, and then wait for a response:
#include <iostream>
#include <cstring>
#include <unistd.h>
#include <arpa/inet.h>
int main() {
int sock = 0;
struct sockaddr_in serv_addr;
const char *hello = "Hello from client";
char buffer[1024] = {0};
// Create socket
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
std::cout << "Socket creation error" << std::endl;
return -1;
}
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(PORT);
close(sock);
return 0;
}
3. Integrating OpenGL
To integrate OpenGL for rendering purposes, you will need to add the necessary OpenGL code
to the client. Here’s an example:
#include <GL/glut.h>
#include <iostream>
#include <cstring>
#include <unistd.h>
#include <arpa/inet.h>
int sock = 0;
char server_message[1024] = {0};
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
void setupSocket() {
struct sockaddr_in serv_addr;
// Create socket
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
std::cout << "Socket creation error" << std::endl;
exit(-1);
}
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(PORT);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(800, 600);
glutCreateWindow("OpenGL Client");
glutDisplayFunc(display);
glutMainLoop();
close(sock);
return 0;
}
CHAPTER 8
SNAPSHOTS
CONCLUSION
The users of this client server simulation will be able to view content as it takes place in the client
– server network. The fully functional system as per the functional requirements is ready for
deployment. It will be used share study materials at the institutional level and later will be made
open for public to use. Testing of the application is done to ensure its integrity and reliability.
The simulation serves to provide a simulation where the users can see the data packets as they
move between the client and server within a given network. This can be used for educational
purposes where the students can learn about what exactly happens in TCP communication. This
also saves work for the professor or faculty who have an interest or work in computer networks in
general. The simulation allows users to visualize the many aspects of network communication
including the different functions such retrieve, store and list which cannot be explained very easily
to first timers.
A graphical representation with different colors used to explain the various aspects of the
components and their working saves several hours of time and effort spent in explaining the
concepts and improves the overall lecture instead of explaining it on a board or paper. This helps
the user or student understand networks and how the PC connects to the internet in general.
FUTURE ENHANCEMENTS
2. Explanation of routing through the network using different network devices such as router,
hub, gateway, etc.
3. Connectivity in the network.
REFERENCES
1. https://www.opengl.org/
2. https://stackoverflow.com/
3. https://www.britannica.com/technology/client-server-architecture
4. https://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_Introduction.html
5. Donald Hearn & Pauline Baker: Computer Graphics with OpenGL Version, 3rd Edition,
Pearson Education,201.
6. Edward Angel: Interactive Computer Graphics- A Top Down approach with OpenGL, 5th
edition Pearson Education, 2008.