0% found this document useful (0 votes)
7 views33 pages

Chap 6

Chapter 6 discusses client-server computing and web technologies, focusing on the roles of clients and servers in network communication. It explains key concepts such as URLs, HTTP, and socket programming, detailing how data is transferred between clients and servers using protocols like TCP and UDP. The chapter also covers server-side programming languages like PHP and the Common Gateway Interface (CGI) for creating dynamic web applications.

Uploaded by

keliman190
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)
7 views33 pages

Chap 6

Chapter 6 discusses client-server computing and web technologies, focusing on the roles of clients and servers in network communication. It explains key concepts such as URLs, HTTP, and socket programming, detailing how data is transferred between clients and servers using protocols like TCP and UDP. The chapter also covers server-side programming languages like PHP and the Common Gateway Interface (CGI) for creating dynamic web applications.

Uploaded by

keliman190
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/ 33

Chapter 6:

Client-server computing
Web technologies:
⁕ Server-side programs
⁕ Socket programs
⁕ Server sockets
⁕ Client sockets
WEB
❑ The World Wide Web is one of the most widely used
services in the Internet. Because the Web is complex,
many protocol standards have been devised to specify
various aspects and details.
Uniform Resource Locator(URL)
✓ Specifies the location and method to access a resources
✓ Reading Files From the Internet
✓ URL is a reference or address to a resource over a
network (e.g., on the Internet).
✓ URL can be used to represent the "location" of a webpage
or web-based application.
✓ A URL is really just a String that represents the name of a
resource ... which can be files, databases, applications, etc
Example
http://www.cnn.com/
http://www.google.com
http://www.google.com:8080/ipad/index.html
(HTML) Hypertext Markup Language.
❑ is a representation standard that specifies the syntax
for a web page. HTML format:
Cont’d
✓ HTTP is the primary transfer protocol that a browser
uses to interact with a web server.
✓ In terms of the client-server model, a browser is a client
that extracts a server name from a URL and contacts the
server.
✓ Four major request types that a browser sends an
HTTP request to the server.
Cont’d
Cont’d
Two Basic Internet Communication Paradigms
a stream paradigm and a message paradigm.
The Client-Server Model Of Interaction
Network -based systems consist of a server , client , and a media
for communication.
❑ A computer running a program that makes a request for
services is called client
❑ A computer running a program that offers requested
services from one or more clients is called server
❑ The media for communication can be wired or wireless
network.
HTTPs Hyper Text Transfer
Protocol
✓ Encrypts the data between the browser and the
server
✓ Ensures the security and privacy issues
Cont’d

Client-Server Communication

Generally, programs running on client machines make


requests, a program (often called as server program) running
on a server machine.
Cont’d
Client software:
✓ is an arbitrary application program that becomes a
client temporarily when remote access is needed,
but also performs other computation
✓ is invoked directly by a user, and executes only
for one session
✓ Runs locally on a user’s personal computer
✓ Actively initiates contact with a server
✓ Can access multiple services as needed, but
usually contacts one re-mote server at a time
✓ Does not require especially powerful computer
hardware
Server side programming
‫ ﺲ‬CGI

‫ ﺲ‬CGI with C++

‫ ﺲ‬Server side scripting with PhP


Server software:
❖ is privileged program providing that can handle multiple remote
clients at the same time

❖ is invoked automatically when a system boots, and continues to


execute through many sessions

❖ Runs on a large, powerful computer

❖ Waits passively for contact from arbitrary remote clients

❖ Accepts contact from arbitrary clients, but offers a single service

❖ Requires powerful hardware and a sophisticated operating system


▪ The server can communicate with only one client at a time
client/server scenarios in real life:
Bank tellers (server) provide a service for the account
owners (client)
Travel agents (server) provide a service for people
wishing to go on vacation (client)
- In some cases, servers themselves may become clients at
various times.
E.g., travel agents will become clients when they phone
the airline to make a reservation or contact a hotel to book a
room.

✓ In the general networking scenario, everybody can either be


a client or a server at any time.
✓ This is known as peer-to-peer computing. In terms of writing
java applications it is similar to having many applications
communicating among one another.
A server is any application that provides a service and allows
clients to communicate with it.
Such services may provide:
transactions for bank accounts
an ability to order products
an ability to make reservations
a way to allow multiple clients to interact

A client is any application that requests a service from a serve


The client typically "uses" the service and then displays results
to the user
CGI - Common Gateway Interface
❑ CGI is a standard for interfacing external
applications with information servers, such as
HTTP or Web servers.

❑ The CGI is the most basic tool to access system


resources on the server.
Creating CGI Applications
A CGI application (commonly called a CGI
script) can be written in any language, i.e.
virtually any programming language,
including C/C++, TCL
PHP
❑ The PHP Hypertext Preprocessor (PHP) is a
programming language that allows web
developers to create dynamic content that
interacts with databases.

❑ PHP is basically used for developing web


based software applications.
Cont’d
✓ PHP is a server side scripting language that is embedded in
HTML. It is used to manage dynamic content, databases, session
tracking, even build entire e- commerce sites.

✓ It is integrated with a number of popular databases, including


MySQL, Oracle, Sybase, and Microsoft SQL Server.

✓ PHP supports a large number of major protocols such as POP3,


IMAP, and LDAP. PHP4 added support for Java and distributed
object architectures (COM and CORBA.
Socket Programming
◼ Applications Layer
◼ Standard apps
◼ HTTP
◼ FTP
◼ Telnet
◼ User apps
◼ Transport Layer
◼ TCP
◼ UDP
◼ Programming Interface:
◼ Sockets
◼ Internet Layer
◼ IP
◼ Network Acess
◼ Device drivers
What is socket
Socket : provide an interface for programming networks at the
transport layer.
❑ is An interface between application and network
❑ In other words it is door between application process and end-
end-transport protocol
– The application creates a socket
– The socket type dictates the style of communication
• reliable vs. best effort
• connection-oriented vs. connectionless
Cont..

✓ A socket is one endpoint of a two-way communication


link between 2 programs running on the network.
✓ A socket is bound to a port number so that the TCP
layer can identify the
application to which the data is to be sent. It is similar to
the idea of plugging the two together with a cable.
Cont..
✓ The port number is used as the server's location on the
machine that the server application is running. So if a
computer is running many different server applications on
the same physical machine, the port number uniquely
identifies the particular server that the client wishes to
communicate with:

aClientSocket.close();
Cont..

❑ Port number is analogous to an apartment number. All


doors (sockets) lead into the building, but the client only
has access to one of them, located at the provided
number.

❑ There fore port is :A number used to identify a


connection point to a specific Internet protocol.

✓ In order to send messages to the server, the client


needs to know the IP address and the port number of
the server.
Cont..
❑ In a lower Transport Layer of communication, there
is a separate protocol which is used to determine
how the data is to be transported from one machine
to another:
❑ Two socket types for two transport services:
UDP: unreliable datagram
TCP: reliable, byte stream-oriented
Socket programming with TCP
❑When contacted by client,
Client must contact server server TCP creates new
✓ server process must first be running socket for server process to
✓ server must have created socket communicate with client
(door) that welcomes client’s contact ➢ allows server to talk
Client contacts server by: with multiple clients
application viewpoint
✓ creating client-local TCP socket TCP provides reliable, in-order
✓ specifying IP address, port number of transfer of bytes (“pipe”)
server process between client and server

✓ When client creates socket: client


TCP establishes connection to server
TCP
Socket programming with UDP

UDP: no “connection” between


application viewpoint
client and server
▪Sends independent data called UDP provides unreliable transfer
of groups of bytes (“datagrams”)
datagram between client and server
▪no handshaking
▪No guarantee whether data is
arrived
▪sender explicitly attaches IP
address and port of destination
UDP: transmitted data may be
received out of order, or lost
Cont..
✓ At the layer is a Network Layer for determining how to locate
destinations for the data (i.e., address) and at the lowest level
(for computers) there is a Link Layer which actually handles
the transferring of bits/bytes
✓ So, internet communication is built of several layers:

✓ When you write JAVA applications that communicate over a network, you
are programming in the Application Layer
Protocol
✓ A Protocol is a standard pattern of exchanging
information
✓ It is like a set of rules/steps for communication. The
simplest example of a protocol is a phone
conversation:
1. Mr X : dials a phone number
2. Mr Y: says "Hello..."
3. Mr X: says "Hello..."
4. ......
5. Mr X : says "Goodbye"
6. Mr Y: says "Goodbye

If these steps are not followed, confusion occurs


✓ Protocol cont..

✓ One more important definition we need to


understand is that of a port:
✓ A port is used as a gateway or "entry point" into an
application
✓ computer usually has a single physical connection to
the network, data sent by different applications or
delivered to them do so through the use of ports
configured on the same physical network connection

You might also like