Lecture 1 - Introduction
Lecture 1 - Introduction
• Prerequisites:
• INFO 5100 Minimum Grade of B-
• CSYE 6200 Minimum Grade of B-
• CSYE 6202 Minimum Grade of B-
• CSYE 6205 Minimum Grade of B-
What is computer networking?
• Networking is the practice of linking two or more computing
devices together.
• http://74.125.226.9
• http://54.239.17.6
• http://157.166.226.26
• With this method, the two computers can guarantee that the data has arrived
safely and correctly, and then they disconnect the connection.
• This method of transferring data tends to be quicker and more reliable, but
puts a higher load on the computer as it has to monitor the connection and
the data going across it.
• A real life comparison to this method would be to pick up the phone and call a
friend. You have a conversation and when it is over, you both hang up,
releasing the connection.
TCP vs UDP Cont’d
• Using UDP, the computer sending the data packages the information into a nice
little package and releases it into the network with the hopes that it will get to the
right place.
• What this means is that UDP does not connect directly to the receiving computer
like TCP does, but rather sends the data out and relies on the devices in between
the sending computer and the receiving computer to get the data where it should
go properly
• This method of transmission does not provide any guarantee that the data you
send will ever reach its destination.
• On the other hand, this method of transmission has a very low overhead and is
therefore very popular to use for services that are not that important to work on
the first try.
• A comparison you can use for this method is the plain old US Postal Service.
• You place your mail in the mailbox and hope the Postal Service will get it to the
proper location.
• Most of the time they do, but sometimes it gets lost along the way.
TCP and UDP Ports
• As you know every computer or device on the Internet must have a unique number assigned
to it called the IP address. This IP address is used to recognize your particular computer out
of the millions of other computers connected to the Internet.
• When information is sent over the Internet to your computer how does your computer accept
that information? It accepts that information by using TCP or UDP ports.
• An easy way to understand ports is to imagine your IP address is a cable box and the ports
are the different channels on that cable box.
• The cable company knows how to send cable to your cable box based upon a unique serial
number associated with that box (IP Address), and then you receive the individual shows on
different channels (Ports). Ports work the same way.
• You have an IP address, and then many ports on that IP address. When I say many, I mean
many. You can have a total of 65,535 TCP Ports and another 65,535 UDP ports.
• When a program on your computer sends or receives data over the Internet it sends that data
to an IP address and a specific port on the remote computer, and receives the data on a
usually random port on its own computer.
• If it uses the TCP protocol to send and receive the data then it will connect and bind itself to a
TCP port. If it uses the UDP protocol to send and receive data, it will use a UDP port.
• Note that once an application binds itself to a particular port, that port can not be used by any
other application. It is first come, first served.
Ports Cont’d
• In order for a web server to accept connections from remote computers, it must
bind the web server application to a local port.
• It will then use this port to listen for and accept connections from remote
computers.
• Web servers typically bind to the TCP port 80, which is what the http protocol
uses by default, and then will wait and listen for connections from remote
devices.
• Once a device is connected, it will send the requested web pages to the remote
device, and when done disconnect the connection.
• On the other hand, if you are the remote user connecting to a web server it would
work in reverse.
• Your web browser would pick a random TCP port from a certain range of port
numbers, and attempt to connect to port 80 on the IP address of the web server.
• When the connection is established, the web browser will send the request for a
particular web page and receive it from the web server.
• Then both computers will disconnect the connection.
Ports Cont’d
• Now, what if you wanted to run an FTP server, which is a server that allows you
to transfer and receive files from remote computers, on the same web server.
• FTP servers use TCP ports 20 and 21 to send and receive information, so you
won't have any conflicts with the web server running on TCP port 80.
• Therefore, the FTP server application when it starts will bind itself to TCP ports
20 and 21, and wait for connections in order to send and receive data.
• Most major applications have a specific port that they listen on and they register
this information with an organization called IANA. You can see a list of
applications and the ports they use at the IANA Registry.
• With developers registering the ports their applications use with IANA, the
chances of two programs attempting to use the same port, and therefore causing
a conflict, will be diminished.
Static vs. Dynamic Web Pages
• A static Web page is a Web page that always comprises the same
information in response to all download requests from all users.
• Web pages that adhere to the second definition are often created
with the help of server-side languages such as PHP, Perl, ASP or
ASP.NET, JSP, and other languages.
Amazon.com in 1995
Discussion
• Which site is more complex?
• http://www.northeastern.edu
• http://www.google.com
Dynamic Data-Driven Web Site
• Why do we need to execute code on the server?
Surfing the Internet
• When you surf the Internet, you basically request for a certain file
located in a particular computer in the location you specify in the
Uniform Resource Locator (URL).
• The computer where the file is stored is called the web server.
• This computer's main function is to serve anybody on the Internet who
requests files it hosts.
• Because you never know when a user will visit and use your web
application, your web server must be up and running all the time.
• When you click or type in a URL in the Location or Address box of your
browser, the following things happen:
• The client browser establishes a TCP/IP connection with the server.
• The browser sends a request to the server.
• The server sends a response to the client.
• The server closes the connection.
HTTP Revisited
• HTTP is the protocol that allows web servers and browsers to exchange
data over the web.
• It is a request and response protocol.
• The client requests a file and the server responds to the request.
• In HTTP, it's always the client who initiates a transaction by establishing
a connection and sending an HTTP request.
• The server is in no position to contact a client or make a callback
connection to the client.
• Either the client or the server can prematurely terminate a connection.
• For example, when using a web browser you can click the Stop button
on your browser to stop the download process of a file, effectively
closing the HTTP connection with the web server.
HTTP Requests
• An HTTP transaction begins with a request from the client browser
and ends with a response from the server.
<HTML>
<HEAD>
<TITLE>HTTP ResponseExample</TITLE>
</HEAD>
<BODY>INFO625050 Web Tools</BODY>
</HTML>
System Architecture
• A well-designed software application is partitioned into separate logical parts
called layers.
• Each layer has a different responsibility in the overall architecture.
• These layers are purely abstractions, and do not correspond to physical
distribution.
• Typical layers in a software system are as follows:
• Presentation layer.
• In this layer are parts that handle the user interface and user
interaction.
• Business logic layer.
• This layer contains components that handle the programming logic of
the application.
• Data layer.
• This layer is used by the business logic layer to persist state
permanently.
• This layer normally consists of one or more DBs where data is stored.
The Two-Tier Architecture
• A two-tiered application is a simple client-server application in which the
processing workload falls onto the client computer's shoulders and the
server simply acts as a traffic controller between the client and the data.
• The term "fat client" for this type of architecture is due to the bulk of
processing requirements at the client side.
• In this architecture, the presentation layer and the business logic layer
are hosted in one tier and the data layer is on another tier.
Problems with Two-Tier Architecture
• The drawback of this type of architecture is that it starts to pose problems as the
number of clients increases.
• The first tier contains the presentation layer, the second tier, or the
middle tier, consists of the business logic layer, and the third tier
contains the data layer.
Java Enterprise Edition
• First of all, J2EE is not a product.
• Rather, it is a specification that defines the contract between applications and the
container.
• The container here refers to a standardized runtime environment, which provides
specific services for components deployed in it.
• Servlets are Java programs that run on Web or application servers, acting as
a middle layer between requests coming from Web browsers or other HTTP
clients and databases or applications on the HTTP server.
Discussion
• Why wait until the client requests the page and then have a program build
the result?
• Yes, many client requests can be satisfied by prebuilt documents, and the
server would handle these requests without invoking servlets.
• There are a number of reasons why Web pages need to be built on-the-fly.
Why web pages need to be built on-the-fly?
• The Web page is based on data sent by the client.
• For instance, the results page from search engines and order confirmation pages
at online stores are specific to particular user requests.
• You don’t know what to display until you read the data that the user submits.
• The Web page is derived from data that changes frequently.
• If the page changes for every request, then you certainly need to build the
response at request time.
• If it changes only periodically, however, you could do it two ways:
• you could periodically build a new Web page on the server (independently of
client requests)
• you could wait and only build the page when the user requests it.
• The right approach depends on the situation, but sometimes it is more convenient
to do the latter: wait for the user request. For example, a weather report or news
headlines site might build the pages dynamically, perhaps returning a previously
built page if that page is still up to date.
• The Web page uses information from databases or other server-side sources.
• If the information is in a database, you need server-side processing.
JSP/Servlets in the Real World: Airlines
JSP/Servlets in the Real World: Financial Services
JSP/Servlets in the Real World: Retail
JSP/Servlets in the Real World: Entertainment
JSP/Servlets in the Real World: Military and Government
JSP/Servlets in the Real World: Sports
JSP/Servlets in the Real World: Search/Portals