ASSnIGNMENT 5
ASSnIGNMENT 5
QUE-1 Explain the Remote Procedure Call (RPC)? Explain advantage and
disadvantage of RPC.
ANS:- A Remote Procedure Call (RPC) is a communication protocol that allows a
program to request a service from a program located on another computer or
server on a network. In simpler terms, it allows a client to execute code or
functions (procedures) on a remote server without having to explicitly manage
the details of the network communication.
The process of an RPC typically involves:
1. Client-side Call: The client invokes a function in a program that runs
locally, but it is set up to actually call a remote function on a server.
2. Marshalling: The client’s request is packaged (or marshaled) into a
standard format for transmission over the network.
3. Transport: The request is sent over the network to the remote server
Advantages of RPC
1. Abstraction of Network Details:
o RPC abstracts the underlying communication details. The client
and server communicate seamlessly as if they are calling local
functions, without needing to manage the intricacies of the
network.
2. Language Independence:
o RPC can be implemented in various programming languages. As
long as both the client and server use a compatible protocol (e.g.,
XML-RPC, JSON-RPC, gRPC), communication can occur even
between different languages and platforms.
Disadvantages of RPC
1. Performance Overhead:
o RPC involves additional overhead compared to local function calls
because of the network latency, the process of
marshalling/unmarshalling data, and the transport layer. This can
lead to performance issues, especially in high-latency or low-
bandwidth environments.
2. Network Failures:
o RPC relies on network communication, so if the network fails or
there is a connection problem, the RPC call may fail. This is
especially true for synchronous RPC, where the client is blocked
waiting for the server response.
QUE-3 Explain HTTP and HTTPS in details, what are port their port numbers.
ANS:- HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer
Protocol Secure) – Detailed Explanation
HTTP and HTTPS are protocols used for transferring data over the World Wide
Web. They are the foundation of communication for most web applications,
allowing the retrieval of web pages, sending data to servers, and enabling
other interactions on the Internet.
HTTP (Hypertext Transfer Protocol)
HTTP is a protocol used for transmitting data over the web. It defines how
messages are formatted and transmitted between clients (such as web
browsers) and servers, and it also describes how web servers and browsers
should respond to various commands.
Key Features of HTTP:
1. Request-Response Model:
o HTTP operates using a request-response model. A client (typically
a web browser) sends an HTTP request to the server, and the
server sends an HTTP response back to the client. For example,
when you open a website, your browser sends an HTTP request to
the server hosting that website, and the server responds with the
content (HTML, images, etc.).
2. Stateless:
o HTTP is stateless, meaning each request is independent, and the
server doesn't retain any memory of past requests. After a
response is sent, the connection is closed, and the server forgets
about the request. For this reason, cookies and other mechanisms
are often used to maintain session state.
3. Methods:
o HTTP defines several methods (also called HTTP verbs) to perform
actions on resources (web pages, images, etc.). Some common
HTTP methods include:
▪ GET: Requests data from a server (e.g., fetching a web
page).
▪ POST: Sends data to the server (e.g., submitting a form).
4. Status Codes:
o HTTP responses come with a three-digit status code that indicates
the result of the request. Some common status codes include:
HTTP Ports:
• Port 80: HTTP uses port 80 by default for communication. When you visit
a website (e.g., http://example.com), your browser connects to the
server on port 80 unless specified otherwise.
HTTPS (Hypertext Transfer Protocol Secure)
HTTPS is the secure version of HTTP. It is used to encrypt data during
transmission, ensuring privacy and security, which is especially important for
sensitive transactions like online banking, shopping, and login pages. HTTPS
uses SSL (Secure Sockets Layer) or its more modern version TLS (Transport
Layer Security) to provide encryption.
How HTTPS Works (Overview)
1. Client Requests Connection: When a client (browser) connects to a
server using HTTPS (e.g., https://example.com), it sends a request to
establish a secure connection.
2. Server Sends SSL/TLS Certificate: The server responds with its SSL/TLS
certificate, which contains the server's public key and other details. The
certificate is issued by a trusted Certificate Authority (CA).
Conclusion
• HTTP is the foundational protocol for transferring data on the web but
lacks security features like encryption and authentication. It is
appropriate for non-sensitive browsing, but it leaves the data vulnerable
to interception or tampering.
• HTTPS builds on HTTP by adding a layer of security using SSL/TLS
encryption, ensuring that data is kept secure, and verifying the
authenticity of websites. It is essential for any website that handles
sensitive data, such as online banking, e-commerce, and user
authentication.
The use of HTTPS has become the standard for most websites, especially with
growing concerns about privacy and data security. As a result, websites without
HTTPS may be flagged as insecure in modern web browsers, impacting user
trust and engagement.
1. Connection Establishment:
2. Reliability:
o TCP ensures reliable data transfer. If a packet is lost, corrupted, or delayed, the
receiver can request the sender to retransmit it. TCP guarantees that the data will be
received correctly and in the right order, or the connection is terminated.
3. Flow Control:
o TCP provides flow control to prevent the sender from overwhelming the receiver
with too much data at once. This is done using window size and acknowledgments.
o UDP does not provide flow control, meaning it can potentially send data at a faster
rate, which could lead to data loss if the network or receiver is overwhelmed.
4. Ordering of Data:
o TCP guarantees the order of data delivery. If the packets arrive out of order, TCP will
rearrange them into the correct sequence before passing them to the application
layer.
o UDP does not guarantee the order of data. Packets may arrive in any order, and it is
up to the application layer to handle ordering if required.
5. Speed:
o TCP is generally slower due to the overhead of maintaining the connection, ensuring
reliability, and performing error-checking.
o UDP is faster because it does not have the overhead of maintaining a connection or
ensuring reliability, making it suitable for real-time applications where low latency is
important.
6. Error Handling:
o UDP only performs error detection using checksums but does not handle error
correction. If a packet is lost or corrupted, it is not retransmitted.
7. Header Size:
o TCP headers are larger (20–60 bytes), containing fields for sequence numbers,
acknowledgments, flow control, and error detection.
o UDP headers are much smaller (8 bytes) because they only contain the necessary
information to identify the source and destination of the packet.
Use Cases
• Examples:
o File Transfer (FTP): Large files need to be transferred without corruption, and
retransmission of lost data is necessary.
o Email (SMTP, IMAP, POP3): Ensures that emails are reliably sent and received
without loss or duplication.
• Examples:
o Online Gaming: Requires fast transmission of game data (position updates, scores)
with minimal latency, and can tolerate some packet loss.
o DNS (Domain Name System): The quick query-response nature of DNS requests
benefits from the low overhead of UDP.
Conclusion
• TCP is ideal for applications where data integrity, reliability, and correct ordering are crucial,
such as web browsing, file transfers, and emails.
• UDP, on the other hand, is ideal for applications where speed is critical, and occasional
packet loss is acceptable, such as real-time communication, online gaming, and video
streaming.
The choice between TCP and UDP largely depends on the specific requirements of the application,
such as whether reliability or speed is more important.
4o mini