Concepts with Symbian OS (779878), страница 55
Текст из файла (страница 55)
The final destination can be a humanreader or an application.• Timestamps : a message is typically given information about the timeand date when an operation is performed on it. A message can receivemany timestamps and can have many operations performed on it. Anemail message, for example, may travel through several relay pointsbefore arriving at its final destination and bear timestamps from eachrelay point.• Content : a message usually carries content information to its intendeddestination.
While the content could be empty, it is still considered tobe part of the message’s definition.• Format : different types of messages take different forms. However,messages tend to have a common organizational format: a header anda body. The message header contains information about the messageitself, such as sender, destination, delivery options and timestamps.The body of a message contains its content, that is, the informationthe message was meant to convey to its recipient. Beyond this generalstructure, messages vary widely in how they represent or format eachmessage section.Consider the email in Figure 13.1. This email message is in the formthat is exchanged between two devices (not necessarily in the final forma person might read).This message has a typical format.
The header is separated from thebody by a blank line (about two-thirds of the way down the message). Youcan easily spot the sender and destination by the ‘From:’ and ‘To:’ lines.The header contains several timestamps. The ‘Received:’ fields displayinformation about the relays the message went through. Note that thereis a lot of information in the header, more than is typically useful. In thiscase, the body of the message is an ASCII-based textual message.Message sending and receiving typically involves both servers andclients. A typical scenario is depicted in Figure 13.2.
The sender composesthe message on his or her local device. The message is then ‘sent’ – whichmeans it is uploaded to a server, either over a conventional, wired network266MESSAGINGReceived: from mail.brainshareproject.com (mail.brainshareproject.com)by smaug.cs.hope.edu (8.9.3+Sun/8.9.1) with ESMTP id AAA09235for <jipping@cs.hope.edu>; Wed, 27 Jun 2006 00:33:11 -0400 (EDT)Received: from debian (dialup-209.Dial1.Level10.net [192.245.239.242])by mail.brainshareproject.com (EL-8_9_3_3/8.9.3) with ESMTP id VAA14057for <jipping@cs.hope.edu>; Tue, 26 Jun 2006 21:32:46 -0700 (PDT)Received: from jjones by debian with local (Exim 3.22 #1 (Debian))id 15F70M-0000UR-00for <jipping@cs.hope.edu>; Tue, 26 Jun 2006 23:32:42 -0500Date: Tue, 26 Jun 2006 23:32:42 -0500From: John Jones <jjones@brainshareproject.com>To: jipping@cs.hope.eduSubject: Infomercials.orgMessage-ID: <20060626233241.A1876@brainshareproject.com>Mime-Version: 1.0Content-Type: text/plain; charset=us-asciiContent-Disposition: inlineUser-Agent: Mutt/1.3.18iX-StarTrek-Quote: Make it so.Sender: John Jones <jjones@brainshareproject.com>Content-Length: 701I want to bounce this site off you:http://www.infomercials.org/and hear any opinions you have on the material it presents.
They seem tohave a very well-thought-out approach to managing large (or small) numbersof customers.John J.Figure 13.1 Example email messageor a wireless network. This server, known as a message center or relayserver, must now deliver the message.There are also delivery methods that work on a peer-to-peer basis.These methods allow local message composition and delivery of theFigure 13.2 A typical message-delivery scenarioTHE CHARACTER OF MESSAGING267message directly to the recipient. The message-relay server is removedfrom the loop.In general, there are two models for message delivery:• push model : if it can, the server delivers the message directly; it contacts the destination device and pushes the message to it; this requiresthat the destination is ready to receive messages; SMS messages areexamples of this type of delivery• pull model : when a device is not usually connected to a wired ormobile network, the server stores the message for the recipient; thereceiving device must contact the server and pull its messages fromthe server; often, in this model, the message-relay point is not themessage-storage point; the storage server receives the message fromthe message relay and keeps it for the recipient; email messages areexamples of this type of delivery system.Note that the pull model may involve the push model.
A device mightpull its messages by notifying a server that it is online and ready. The serverthen uses push-model mechanisms to deliver content to that device.Electronic mailElectronic mail is one of the most common and widely used forms ofmessaging. It was originally developed as an electronic means of sendingtext-based messages – textual ‘mail’ for human consumption – betweencomputers. As the value of sending messages was realized, people beganto send other things as well. Email has evolved to encompass all typesof objects, for example, programs, spreadsheets and word-processingdocuments.The format of an email message is shown in Figure 13.1.1 As we havestated, it has a header and a body.
The header is comprised of a sequenceof lines or fields, each of which is composed of a key and a value. Eachfield relays information about the message to the receiver. The sender isrequired to insert a ‘From’ field, a ‘To’ field, and a ‘Posted-Date’ field intothe message header and is free to insert other fields.
In addition, any fieldwhose key value begins with the string ‘X-’ may be inserted by the user(note the X-StarTrek-Quote field in Figure 13.1).1The most widely used format for email messages is specified by the Internet EngineeringTask Force in a document called RFC 821.268MESSAGINGThe body of an email message contains the message content. Thiscontent is typically composed of a message in ASCII or Unicode text.However, the message body can also have attachments, which are dataobjects that accompany the message. These objects are included usinga standard called Multipurpose Internet Mail Extensions (MIME). Objectsincluded using MIME are each included in a message type format, witha header to identify the type of the data object and a body that containsthe data object itself.
Many objects can be included in a message.Even when it includes MIME objects, an email message has a textbased representation. All email is sent using readable (ASCII/Unicode)characters. If a message contains attachments that are not comprised oftext, then those attachments are encoded in a special way to derive textfrom them. The encoding method used, e.g., base 64, is included in theheader for the data object, so the receiving software can decode theobject. The delivery of email messages to the end user follows the pullmodel of message delivery.There are several protocols that are used to send and receive email.By far, the most widely used sending protocol is Simple Mail TransferProtocol (SMTP).
There are two protocols used to receive or read email:Post Office Protocol (POP) and Internet Message Access Protocol (IMAP).These are TCP/IP-based protocols.Look at Your EmailLook at your own email messages to verify the format we specify here.Save your email to a file and examine the file’s contents. If you can,find a mail message with attachments and look at the contents. Youmay have to specify a ‘save headers’ or ‘save all headers’ property toyour mail reader; often a mail reader saves only those header fieldsthat it deems interesting.
Use the headers to track the path your emailmessage has gone through to reach you.SMS messagingEmail messages are meant to be in a general form that adapts to mostcomputer systems. They are text-based, so most devices can read andrelay them. They are flexible enough to accommodate many differenttypes of data objects. By contrast, SMS messages are very specific andtargeted by their nature to a specific carrier technology.THE CHARACTER OF MESSAGING269SMS messages are short messages, 160 characters or less, and arespecifically targeted for mobile phones, usable on a wide range ofnetworks.
They are data messages which are not intended to be vieweduntil they are decoded and displayed. The sending of SMS messagesadheres to the push model of message delivery. Messages are sent to aservice center that relays the message and delivers it to its destination.The service center contacts the receiving device and keeps trying until itfinds the device powered on and receiving messages.An SMS message follows the standard message format in that there isa message header and a message body. The header contains informationabout the message and the body contains the message itself. The SMSmessage below contains the message ‘hello’:07917283010010F5040BC87238880900F10000993092516195800AE83229BFD46Note that the data is actually a stream of bits and written above inhexadecimal.
If this message were to be received on a GSM phone,chances are that phone would display ‘hello’. It is fairly obvious that weare dealing with a different type of message than we dealt with for email.Let’s examine this message and by this example examine the SMSstandards for messaging. The table below analyzes the pieces of theexample SMS message above.Data FieldDescription07The length of the service center information.In this case, the number is 7 octets.91The type of service center address. In thiscase, 91 means the phone number has aninternational format.72 83 01 00 10 F5The service center address in ‘decimalsemi-octets’.
Although formatted like octets,the number reads in decimal digits. Becausethe service center address has an oddnumber of digits, it is padded with F (allones) to pad out the octet. Here, the numberis +27381000015.270Data FieldMESSAGINGDescription04Type of message. This is an SMS-DELIVERmessage.0BSender address length. Here, 0B means thesender address is 11 digits.C8The type of the sender’s address.72 38 88 09 00 F1The sender’s address, in decimalsemi-octets. Note the padding.