470 likes | 638 Views
COMP3241 E-Commerce Technologies. Richard Henson University of Worcester October 2014. Week 2: Client-Server systems and E-commerce. Objectives: Describe the client-server model Explain what communications protocols are and their role in client-server networks
E N D
COMP3241E-Commerce Technologies Richard Henson University of Worcester October2014
Week 2: Client-Server systems and E-commerce • Objectives: • Describe the client-server model • Explain what communications protocols are and their role in client-server networks • Understand the rationale for using server-end code, as an alternative to running the code at the client • Produce working server scripts running on a simulated IIS webserver
Evolution of Networks • Early days: Host/Dumb Terminal • Client/Server & Peer-Peer small boxes just provide input & output Host Small boxes represent computers in “client” mode Server
The Internet: peer-peer AND client/server??? Internet Hosts interact via protocols work on a client-server basis!
Internet Communications: a contradiction? • Internet “Hosts” regarded as Servers • BUT… • EITHER take the role of client • user in one university sends an email to a user in another university: • “A” client sends email to “B” server • OR the role of server • when a reply sent back… • “B” client sends email to “A” server
Client/Server Networks server • Server end: • access control to the network & its resources controlled by logon service • access to resources depends on user rights – assessed by logon data • Client-end: • user who wishes to access network resources client
Web Server • Software… • IIS (Internet Information Server, Microsoft) • Apache (open Source) • Runs on a Windows or Unix “platform” • operating system • running on a powerful computer
Roles of a Web Server • Store web pages • Make web pages available to remote computers using either HTTP or other application layer protocols • Exercise control over who accesses those web pages, and who can edit/delete them • Run server scripts and provide database interaction
Web Browser • Software… (e.g. IE, Firefox, Opera, Chrome) • translates HTML code into a visual screen output • executes programs written in given programming languages e.g. • JavaScript • VBScript • “run-time” code (ActiveX) • interacts with web server using the HTTP& FTP protocols (& HTTPS to deter MITM hackers)
How a Static Web Page gets displayed • First of all, the relevant HTML document must be retrieved: • user types the URL into a one-line text window in browser • browser passes the text to the remote web server (via default Internet gateway)
How a Static Web Page gets displayed (2) • Web server locatesthe file for that web page in its own storage folders • File containing HTML etc code copied back to default gateway • then routed to the IP address of the local computer
How a Static Web Page gets displayed (3) • File suffix checked by browser… • If .htm or .html suffix: • HTML etc. code is read & processed by local CPU using a program called an interpreter
How a Static Web Page gets displayed (4) • Results of processing passed to graphics card CPU • converted into binary display signals by the CPU and graphics card • Signals transmitted to screen; web page displayed…
Break… • Any questions?
Client-side Scripting & Interactive Web Pages • Berners-Lee’s original intention was to display text, links, and simple graphics… • Soon became more sophisticated… • embedded client-side JavaScript, VBScript, or code from other languages • templates and Cascading Style Sheets provided scope for a huge range of formatting options • HTML forms allowed emailing & interaction with remote databases via server
Dynamic Pages: Code running on the Server • Interactive: embedded client-side code • Dynamic: local interaction with remote server • Result: can now display virtually anything • multimedia and special effects available client-side • relational databases allow query/retrieval of complex data structures anywhere on the Internet
Client/Server networks and E-commerce • Connection between client & server only made when user requests information • very efficient… • requires excellent communication between processes • Any client-server system must therefore: • communicate 100% effectively • use an entirely reliable set of protocols • the Internet uses… TCP/IP
Why is knowledge of networks important? client • Any worthwhile E-Business system usually works across: • at least two different systems • a digital link including the Internet Network(s) server
Request and response 1. Client requests information 2. Server processes the request, sends a response back to the client
A single transaction across a client-server network requires (minimum)… Client: Request for services or information from another computer (e.g. the server) Server: response to client's request sending the results of processing the request back to the client computer Request and response web applications
“Middleware” A layer(s) of SOFTWARE that sits between client and server Could “glue” together incompatible formats
More on “Middleware” • Attractions range around “future-proofing” • incompatible computing systems can co-operate and interact with each other • “glued” together to deliver applications to the user seamlessly • applications independent of the underlying network infrastructure • integration with legacy systems(protecting investment in older technology) • Organisations have time to decide what to do with an older “legacy” system • e.g. during w2k “panic”!
Bandwidth & Client/Server processes • Messages transferred between client and server via network… • Need plenty of bandwidth! Seriously!
Bandwidth &Client/Server • Data transfer: the faster the better… • most effective on LANs - nowadays 1000 Mbits/sec at a minimum… • WANs can be slow… • data takes longer going client-server • so longer time to get a response back • server could even “time out” • no good for e-commerce, on-line booking…
Evolution of Client-Server • Protocol needed to RELIABLY transfer data between Internet sites • used client-server • protocol needed to detect errors and resend if necessary • Early model (TCP)… • used in early days of Unix (1970s) • communication between nodes separated into four layers of abstraction, computerized through just 4 software layers: • Physical Network access layer • Internet layer – became IP protocol • Transport or Host-Host – TCP protocol • Application layer – became FTP and SMTP
THE OSI seven layer model • In 1978, four layer model expanded to SEVEN software layers • extra three levels of abstraction • consensus based on software and systems then available • MINIMUM they could agree on… • helpful for efficient client-server communication across different networks, with different protocols • Only a model…
Implementation of the OSI model • Internet becoming more sophisticated • protocols like FTP • First use of a 7 layer protocol… • TCP/IP protocol stack • remains to present day…
OSI-compliant Internet Protocols • OSI application & associated layers (level 5/6/7) links to level 4 via “ports” • ftp uses port 21 • http uses port 80 • At OSI level 4 (transport) • TCP protocol divides the application’s data into "chunks“/packets of an efficient size for routing through packet switching
OSI-compliant Internet Protocols • At OSI Level 3 (network): • packets are created • IP addresses are added as “header” • used in conjunction with packet-switching to navigate packets from source to destination across the physical network • At OSI levels 1 & 2: • packets converted into electrical signals based on binary 1 and 0 and sent…
Break • Questions?
AH AH AH AH AH AH DATA DATA DATA DATA DATA DATA Application Layer Application Layer DATA AH Presentation Layer Presentation Layer PH DATA AH PH Session Layer Session Layer SH SH SH SH PH PH PH PH DATA AH PH SH Transport Layer Transport Layer TH DATA AH PH SH TH Network Layer Network Layer NH TH Data link Layer Data link Layer LH NH TH LT Physical Layer Physical Layer LT DATA AH PH SH TH NH LH DATA AH PH SH TH NH How a message is “sent” Receive Station Transmit Station Link
Preparation of data to send across the network • File/message “chunking” into packets… • TCP orders the file into units of data of a specific size containing header information (for routing) and the data itself • allows packets to be routed between an origin and a destination on the Internet or any other packet-switched network
Packet Size & Management header data • Original TCP/IP used packets with 48 bytes data + 5 bytes header • recent implementations have 768 bytes + header • Large messages broken into many packets • Sometimes very small messages are combined and share a packet
Contents of aTCP/IP “packet” • 1. The main body of information to send (originally 48 bytes) • 2. The packet header (5 bytes) containing: • where to send packet (destination IP address) • where packet came from (source IP address) • error checking information - CRC • TTL (time to live) in case it gets lost!
Movement of Data by Packet-switching • IP protocol • addressing and routing the packet • each packet separately numbered • Individual packets for a given file may take different routes through the Internet • When all packets have arrived at their destination: • TCP at the receiving end reads the packet numbers • reassembles the packets into the correct order to recreate the original file
Packet-switching • Known as “connectionless” (as opposed to “connection-oriented”, like the public telephone system) • unlike the latter, packets do not follow one another in order down a particular path • Most Internet traffic uses packet switching • requires no connection channels • breaking communication down into packets allows the same data path(s) to be shared among many users in the network
More about Application Layer Protocols • FTP (file transfer protocol) • predates the www • used to upload/download files between user computer and the Internet • FTP client program contacts an FTP server • requests the transfer of a file • FTP server responds by transferring the file to the client • HTTP (hypertext transfer protocol) • Used, usually via the Internet: • to upload requests for web pages from a browser on a client computer to a web server • to download web pages from a web server to a browser on a client computer • Can also be used to send data between client and server
HTTP and HTML as “middleware” Web Browser (HTML page) Web Server (Server Script)
Web Static Client-Server Model (simplified – excluding the “local” server)
More about HTTP and Client-Server Computing • Client and server systems work right up to the application layer • communication needs to function accordingly… • Tim Berners-Lee invented HTTP to facilitate web-based application layer communication • To allow client-server interaction, Tim designed HTTP to integrate well with his basic web page formatting language - HTML • HTML language GET command instructs the client process to get data for the server • HTML POST command sends client data either using an email protocol or using HTTP
Server-side scripts & dynamic Web pages • This time, the programming code is sent to and runs at the web server end… • creates a web page for the client end • if database data being returned, needs a table to display the data • How does this all work?
Server-side scripts etc… • If the data picked up from the server has been changed (e.g. by use of SQL query)… • the client display is changed • web pages become “dynamic” • i.e. readily changeable without changing the web page code • Effect: • by triggering SQL commands on the server, a local web page gives an appearance of interacting directly with a database
Web Dynamic Client-Server Model Server-Side processing - typical web-based client-server app: • HTML form displayed on a web browser at the client end collects data • Using HTTP form data sent to web server
Web Dynamic Client-Server Model • The web server processes the data according to instructions on a specified server script • Using HTTP, the results of processing generated as specified by the script are sent back to the client
Web Dynamic Client-Server model • The web browser on the client machine displays the results on a web page in a specified position • This gets even more complex when a database, and database programming, are also involved at the server end…
Exercise for Next Week • Search Google for web hosts • how many available? • how could you choose? • Use the following URL to compare web hosts: • http://www.hostindex.com/voteresults.shtm • select criteria for an e-commerce hosting solution that fit with comparison data • choose a suitable web host (server) for an e-commerce solution