Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
Guide to Embedded System Architecture - Part4 Application Layer Networking Protocol Examples

Guide to Embedded System Architecture - Part4 Application Layer Networking Protocol Examples

Ratings: (0)|Views: 48|Likes:
Published by charliesteven

More info:

Categories:Topics, Art & Design
Published by: charliesteven on Jun 13, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/09/2010

pdf

text

original

 
 
Part of the EE Times Network 
 
Top news from EE Times:
Touch is not enough, say display experts
 
All
Articles
Products
Course
TechPaper 
Webinars
Thursday, June 10, 2010
Guide to Embedded Systems Architecture - Part 4: Application layer networking protocol examples
 Part 1of this article begins by defining "middleware" and looking at some networking middleware driver examples. Part 2offers pseudocode examples for PPP Link Control   Protocol states and a look at the IP networking layer protocol. Part 3looks at a transport layer middleware example using the User Datagram Protocol, as well as examples of embedded Java and networking middleware.]
 
10.4 Application Layer Software Examples
 In some cases, applications can be based upon industry-accepted standards, as shown in Figure 10-27. For example, for devices that need to beable to connect to other devices to transfer data or to have the remote device perform functions on command, an application networking protocol must be implemented in some form in the application layer.Figure 10-27: Application software and networking protocols Networking protocols at the application level are independent of the software that they are implemented in, meaning an application-specific protocol can be implemented within astand-alone application whose sole function is the implementation of that protocol, or can be implemented as a sub-nit of a larger application that provides many functions, as shownin Figure 10-28.10-28: Application software and networking protocolsThe next three examples demonstrate networking protocols implemented in both general-purpose and market-specific applications.
10.4.1 File Transfer Protocol (FTP) Client Application Example
 FTP (File Transfer Protocol) is one of the simplest protocols used to securely exchange files over a network. FTP is based upon RFC959 and can be implemented as a standaloneapplication, solely dedicated to transferring files between networked devices, or within applications such as browsers and MP3 applications. As shown in Figure 10-29, the FTP
 Login 
|
 Register Welcome, Guest
HOME 
DESIGN 
FORUMS 
E-LEARNING 
PRODUCTS 
Page 1 of 8Guide to Embedded Systems Architecture - Part 4: Application layer networking protocol examples6/10/2010http://embeddedinternetdesign.com/design/224701412;jsessionid=NLRAM4NMLSHKVQE1GHOSKHWATM...
 
 protocol defines the communication mechanisms between the device initiating the transfer, called the
 FTP client 
or 
user-protocol interpreter 
(user PI), and the device receiving theFTP connection, called the
 FTP Server 
or 
 FTP Site
.Figure 10-29: FTP network Two types of connections can exist between FTP client and servers: the
control connection
in which commands are transmitted between the devices, and the
data connection
in whichthe files are transmitted. An FTP session starts with the FTP client initiating a control connection by establishing a TCP connection to port 21 of the destination device. The FTP protocol requires its underlying transport protocol to be a reliable, ordered data stream channel, such as TCP (as shown in Figure 10-29).
 Note: the FTP connection mechanism is inart based upon RFC854, the Telnet (terminal emulation) protocol.
 The FTP client, after transmitting its commands, waits for the FTP Site to respond with a reply code over the control connection; these codes are defined in RFC 959 and shown inTable 10-9.Table 10-9: FTP reply codes
[10-6]
 If the response from the FTP site is favorable, the FTP client then sends commands, like the ones shown in Table 10-10, that specify parameters for access control, such as usernameor password, transfer criteria (i.e., data port, transfer mode, representation type, and file structure, etc.), as well as the transaction (store, retrieve, append, delete, etc.).Table 10-10: FTP commands
[10-6]
 The following pseudocode demonstrates a possible initial FTP connection mechanism within an FTP client application in which access control commands are transmitted to an FTPsite.
CodeDefinition
110Restart marker reply120Service ready in "x" minutes125Data connection already open150File status o200Command o202 Command not implemented211System help.........
CodeDefinition
USERUsername access control commandPASSPassword access control commandQUITLogout access control commandPORTData Port transfer parameter commandTYPERepresentation Type – transfer parameter commandMODETransfer mode transfer parameter commandDELEDelete FTP service command.........
FTP Client Pseudocode for access control commands USER and PASS
 FTPConnect (string host, string login, string password) {TCPSocket s= new TCPSocket(FTPServer,21); // establishing a TCP connection to port 21 of the destination device Timeout = 3 seconds; // timeout for establishing connection 3secondsFTP Successful = FALSE;Time = 0;While (time < timeout) {read in REPLY;If response from recipient then {//login to FTPtransmit to server ("USER "+login+ "\r\n");transmit to server ("PASS " + password+ "\r\n");read in REPLY;// reply 230 means user logged in, to proceedif REPLY not 230 {close TCP connectiontime = timeout;} else {time = timeout;
Page 2 of 8Guide to Embedded Systems Architecture - Part 4: Application layer networking protocol examples6/10/2010http://embeddedinternetdesign.com/design/224701412;jsessionid=NLRAM4NMLSHKVQE1GHOSKHWATM...
 
In fact, as shown in the pseudocode below, the FTP client needs to provide mechanisms that support the user being able to transmit the different types of commands (shown in Table10-10) available via FTP, as well as process any response codes received (shown in Table 10-9).The FTP Server initiates the data connection and any transfers according to the commands specified by the FTP client.
10.4.2 Simple Mail Transfer Protocol (SMTP) and E-Mail Example
 Simple Mail Transfer Protocol (SMTP) is a simple application-layer ASCII protocol that is implemented within an
e-mail 
(electronic mail) application for sending mail messagesefficiently and reliably between devices (see Figure 10-30).Figure 10-30: SMTP network diagram
[10-7]
 FTP Successful = TRUE; }}else {time = time + 1;} // end if-then-else response from recipient} // end while (time < timeout)}
FTP Client Pseudocode
 // "QUIT" access command routineFTPQuit () {transmit to server ("QUIT");read in REPLY;// reply 221 means server closing control connectionif REPLY not 221 {// error closing connection with server } close TCP connection}// FTP Service Command Routines// "DELE"FTPDelete (string filename) {transmit to server ("DELE " + filename);read in REPLY;// reply 250 means requested file action Ok if REPLY not 250 {// error deleting file}}// "RNFR"FTPRenameFile (string oldfilename, string newfilename) {transmit to server ("RNFR " + oldfilename);read in REPLY;// reply 350 means requested file action pending further informationif REPLY not 350 {// error renaming file}transmit to server ("RNTO " + newfilename);read in REPLY;// reply 250 means requested file action Ok if REPLY not 250 {// error renaming file}}........
Page 3 of 8Guide to Embedded Systems Architecture - Part 4: Application layer networking protocol examples6/10/2010http://embeddedinternetdesign.com/design/224701412;jsessionid=NLRAM4NMLSHKVQE1GHOSKHWATM...

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->