Professional Documents
Culture Documents
Objectives:
Outline:
1. HTTP
2. SMTP
In its simplest form, a protocol can be defined as the rules governing the syntax, semantics, and
synchronization of communication.
Syntax stands for the grammatical structure of a language. (Language includes both natural language
and programming language).
Semantic stands for the meaning of vocabulary symbols arranged with that structure.
For instance, the following statements use different syntaxes, but result in the same semantic:
Generally these operations would all perform an arithmetical addition of 'y' to 'x'. So, in the above
four statements:
Probably you have understood what syntax and semantics are. Here are their definitions in textbooks:
Semantics refers to the meaning of the vocabulary symbols arranged with that structure.
So, the following statements have the same syntaxes but different semantics:
x = x + y;
sum = sum + grade[i];
And
He is a new student.
You are a good person.
Trees are big dogs.
They are in the same grammar but with different meanings. Note the last statement Trees are dogs;
it is right in syntax but wrong in semantics. Because trees are not dogs at all, so the meaning
(Semantics) of this sentence is wrong, although grammar (syntax) is right.
1. HTTP
When you are surfing on the Internet, you are sending HTTP requests from your Internet Explorer to
websites, such as yahoo.com, which respond with HTTP responses to you.
HTTP stands for Hypertext Transfer Protocol. It's the network protocol used to deliver virtually all
files and other data (collectively called resources) on the World Wide Web, whether they're HTML
files, image files, query results, or anything else. Usually, HTTP takes place through TCP/IP sockets
(and this tutorial ignores other possibilities).
A browser is an HTTP client because it sends requests to an HTTP server (Web server), which then
sends responses back to the client. The standard (and default) port for HTTP servers to listen on is 80,
though they can use any port.
Current version; persistent connections enabled by default and works well with proxies.
Also supports request pipelining, allowing multiple requests to be sent at the same time,
allowing the server to prepare for the workload and potentially transfer the requested
resources more quickly to the client.
HEAD
Asks for the response identical to the one that would correspond to a GET request without the
response body. This is useful for retrieving meta-information written in response headers,
without having to transport the entire content.
GET
Requests a representation of the specified resource. By far the most common method used
on the Web today. Should not be used for operations that cause side-effects (using it for
actions in web applications is a common misuse). See 'safe methods' below.
TRACE
Echoes back the received request, so that a client can see what intermediate servers are
adding or changing in the request.
OPTIONS
Returns the HTTP methods that the server supports. This can be used to check the
functionality of a web server.
And more read http://en.wikipedia.org/wiki/HTTP if you are interested.
telnet www.yahoo.com 80
And
Note: here, both of the statements have same syntax, that is GET FileName HTTP/version.
They have different Semantics, the first one uses HTTP/1.0 while the second one uses HTTP/1.1
1.5 Sample Results:
2. SMTP
In SMTP (and in the rest of this discussion), the client is the computer that is sending email, and the
server is the computer that is receiving it. Thus we say SMTP clients (or SMTP senders) send email
to SMTP servers.
When one sends mail using the SMTP protocol, one has only the following commands:
HELO
Greet the mail server. Used once per session - at the beginning of the session.
HELO is an optional command.
This is optional. And this command must follow the DATA command and the Subjcet:
command ( if there is a Subject: command).
RSET
Reset the state of the current transaction. The MAIL FROM: and RCPT TO: for the current
transaction are cleared.
QUIT
End the session. No commits happen here.
2.3 Do Exercises of Using SMTP to send email
Experiment 1. Send an email to Mr. Kaiyong ZHAO
telnet smtp.comp.hkbu.edu.hk 25
After you see the message: 250 xxxxx Message accepted for delivery, enter:
QUIT
Send an email from any of your preferred email address, to any of your friends email
address.
For example: (the following is example only, DONT send to these emails if you dont know the owner)
The commands are similar to step 1. You just need follow the same syntax with different
semantics of step 1.
Send an email, using a reply-to address that is different from the sender address. As compared to step
1 and step 2, now you need a different syntax for the reply-to function.
Check all the emails of step 2,3 in your email boxes, such as your yahoo, hotmail email box. Your
email sent by step 1 will be checked by the Teaching Assistant as your record of lab 1.
Experiment 3.
[References]
[1] http://www.w3.org/Protocols/, Jan 2009
[2] http://en.wikipedia.org/wiki/HTTP, Jan 2009