Chapter 5
Chapter 5
Activity 6.1
→Markup languages like HTML, CSS, and XML are part of Web technology.
→These languages tell computers in text how to format, layout and style
Web pages and programs.
→Two types of markup languages include procedural markup and descriptive
markup. Additional types of languages include CGI and HTTP.
Programming Languages
Programming languages include Perl, C#, Java and Visual Basic .NET. These
languages are used by Web developers to create websites and applications.
Each language has pros and cons, and most developers know several
different types to help them achieve their goals.
HTML: The Foundation of any Web Site. HTML (HyperText Mark-up
Language) is the glue that holds together every web site. Like building a
house, you always build a strong foundation first. For any site, HTML is that
foundation. HTML is an open-source language (i.e. not owned by anyone),
which is easy to learn, and requires no fancy (or expensive!) packages to
start using it.
All you need is something to type with, such as Windows Notepad, and a lot
of time and patience.
HTML works on a ‘tag’ system, where each tag effects the content placed
within that tag;
<TAG>What the tag effects</TAG>.
CSS(Cascading Style Sheets)
→CSS is a relatively new language, designed to expand upon the limited
style properties of HTML.
→Easy to learn and implement, CSS is an excellent way to control the style of
your site, such as text styles like size, color, and font.
→CSS may also be placed inside the HTML page or in separate files.
Throughout this course, we have been creating HTML with a text editor and
saving .html files.
When these are put on a web server, they are then sent as-is to web
browsers. In this case, the job of the web server is very simple: find the file
and send it out.
We have been able to modify the HTML page with code we have written, but
that was all JavaScript code that runs in the web browser. There was never
any change in the HTML sent from the server to the browser.
But if you think about many web sites you visit, this method of creating web
pages can’t be the whole story. On Facebook, your news feed changes each
time you load it: nobody is sitting there typing HTML to update it for you.
When you search on Google, you might be searching for something nobody
has ever searched for before, so there’s no way the result can be pre-
prepared.
For these sites (and many others), the HTML that is sent from the server to
your browser must be generated when you request it. There is a program on
the web server that can look at your request (what you searched for, or who
you are logged in as, or where you are requesting from, or any other
condition) and create an HTML page specifically for that request.
Web pages that come from .html files on the server are called static web
pages. Web pages that are created as they are requested are called dynamic
web pages.
Writing programs to create dynamic pages is server-side programming since
the programs run on the web server. The programming we have been doing
in JavaScript, where the programs run in the user’s web browser, is called
client-side programming.
We have only made static web pages in this course. That has given us a
good chance to explore the basic ideas of the web, and given us a place to
put JavaScript code to learn about (client-side) programming and do some
interaction with the user.
Creating dynamic web pages requires a few more things that we won’t be
doing in detail here.
First, the web server needs to be configured to actually run a program to
generate a response (instead of just finding a file on disk). This is often the
biggest barrier to exploring server-side programming: you need a web server
and need to set it up appropriately. This isn’t terribly
difficult or expensive, but it can be a challenge for beginners.
Second, you need to be able to write programs that generate the HTTP
response for the user.
This generally means creating HTML with your code. Exactly how that is done
depends on the page you need to create: it will probably involve reading
information from a database, or collecting information from some other
source.
6.3. Socket Programming
Data Communication and Computer Networks (ITec2102) CHAPTER SIX: CLIENT SERVER
Socket Types
There are four types of sockets available to the users. The first two are most
commonly used and the last two are rarely used.
Processes are presumed to communicate only between sockets of the same
type but there is no restriction that prevents communication between
sockets of different types.
Multithreading Concepts
Even though it’s faster for an operating system (OS) to switch between
threads for an active CPU task than it is to switch between different
processes, multithreading requires careful programming in order to avoid
conflicts caused by race conditions and deadlocks.
To prevent race conditions and deadlocks, programmers use locks that
prevent multiple threads from modifying the value of the same variable at
the same time.
In programming, a thread maintains a list of information relevant to its
execution, including the priority schedule, exception handlers, a set of CPU
registers, and stack state in the address space of its hosting process.
Threading can be useful in a single-processor system because it allows the
primary execution thread to be responsive to user input while supporting
threads execute longrunning tasks in the background that do not require
user intervention.
Types of Multithreading
Previous T