410 likes | 570 Views
COMP3241 E-Commerce Technologies. Richard Henson University of Worcester October 2013. 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 October2013
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 further working server scripts running on an 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 network) Internet Hosts Interact on a client-server basis!
Internet Communications • From the start: client & server • Internet “Host” (Server) can EITHER take the role of client OR the role of server • e.g.(1) A user in one university sends an email to a user in another university: • “A” client sends email to “B” server • (2) When a reply comes back… • “B” client sends email to “A” server
Client/Server Networks server • Server end: • access control to the network and 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… (e.g. IIS, Apache) • Runs on a Windows or Unix “platform” • stores web pages • makes web pages available to remote computers using either HTTP or other application layer protocols • exercises control over who accesses those web pages, and who can edit/delete them • runs scripts and provides 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…
Client-side scripting & Dynamic Web Pages • Berners-Lee’s original intention was just text, links, and graphics… • Soon became more sophisticated… • embedded JavaScript, VBScript, or code from other languages • HTML forms allowed emailing & interaction with databases • templates and Cascading Style Sheets provided scope for a huge range of formatting options • Result: can now display virtually anything • very wide range of multimedia and special effects available… • Relational databases allow query/retrieval of complex data structures
Why are client-server networks so important to e-commerce? • Connection between client & server only made when user requests information • very efficient… • But 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 • Middleware can join users to raw data and applications! • Attractions range around “future-proofing” • incompatible computing systems can co-operate and interact with each other – can be 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) • Givesorganisations time to decide what to do with older systems • e.g. during w2k “panic”!
Bandwidth and Client/Server processes • Messages transferred between client and server via network
Bandwidth and Client/Server processes • Data transfer: the faster the better… • most effective on LANs - nowadays 1000 Mbits/sec or more • between connected Internet computers bandwidth needs to be as high as possible - 2 Mbits/sec upwards • Slow connections… • data takes longer to get through • so longer time to get a response back • server could even “time out”
Early Network Protocols • Challenge for client-server data to be RELIABLY transferred between Internet sites • one purpose of the protocol • 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, the network model expanded to SEVEN software layers • included a further three levels of abstraction from physical network through to screen display, this was the MINIMUM number OSI committee could agree on • helpful for efficient client-server communication across different networks, with different protocols • First used in the extended (7 layer…) TCP/IP protocol stack • remains to present day…
OSI-compliant Internet Protocols • When any OSI application layer file (e-mail message, HTML file, GIF file, URL request, and so forth) is sent from one place to another on the Internet… • at OSI level 4, the TCP protocol divides it into "chunks" or packets of an efficient size for routing through packet switching • At OSI Level 3: • packets are created and IP addresses are added • used in conjunction with packet-switching to navigate packets from source to destination across the physical network
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 • this 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 • Traditional TCP/IP used packets with 48 bytes data + 5 bytes header • latest implementations: e.g. 768 bytes + header • Large messages broken into many packets • Sometimes very small messages are combined and share a packet
Contents of a basic 53 byte TCP/IP “packet” • 1. The main body of information to send (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
WWW-related Application Layer (layer 7) 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 and their offerings: • 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