Thursday, October 16, 2014

Explain Protocols: TCP/IP,UDP,SMTP,FTP,HTTP



Explain Protocols: TCP/IP,UDP,SMTP,FTP,HTTP

TCP/IP:
·        TCP and IP were developed by a Department of Defense (DOD) research project to connect a number different networks designed by different vendors into a network of networks (the “Internet").
·        It was initially successful because it delivered a few basic services that everyone needs (file transfer, electronic mail, remote logon) across a very large number of client and server systems.
·        Several computers in a small department can use TCP/IP (along with other protocols) on a single LAN. The IP component provides routing from the department to the enterprise network, then to regional networks, and finally to the global Internet.
·        On the battlefield a communications network will sustain damage, so the DOD designed TCP/IP to be robust and automatically recover from any node or phone line failure. This design allows the construction of very large networks with less central management.
As with all other communications protocol, TCP/IP is composed of layers:
·        IP - is responsible for moving packet of data from node to node. IP forwards each packet based on a four byte destination address (the IP number). The Internet authorities assign ranges of numbers to different organizations. The organizations assign groups of their numbers to departments. IP operates on gateway machines that move data from department to organization to region and then around the world.
·        TCP - is responsible for verifying the correct delivery of data from client to server. Data can be lost in the intermediate network. TCP adds support to detect errors or lost data and to trigger retransmission until the data is correctly and completely received.
·        Sockets - is a name given to the package of subroutines that provide access to TCP/IP on most systems.
UDP:
·        UDP (User Datagram Protocol) is a simple OSI transport layer protocol for client/server network applications based on Internet Protocol (IP). UDP is the main alternative to TCP and one of the oldest network protocols in existence, introduced in 1980.
·        UDP is often used in videoconferencing applications or computer games specially tuned for real-time performance.
·        To achieve higher performance, the protocol allows individual packets to be dropped (with no retries) and UDP packets to be received in a different order than they were sent as dictated by the application.

UDP Datagrams:

·         UDP network traffic is organized in the form of datagrams. A datagram comprises one message unit. The first eight (8) bytes of a datagram contain header information and the remaining bytes contain message data.

·         A UDP datagram header consists of four (4) fields of two bytes each:
Source port number: UDP port numbers allow different applications to maintain their own channels for data similar to TCP. UDP port headers are two bytes long; therefore, valid UDP port numbers range from 0 to 65535.
Destination port number: The UDP datagram size is a count of the total number of bytes contained in header and data sections. As the header length is a fixed size, this field effectively tracks the length of the variable-sized data portion (sometimes called payload). The size of datagrams varies depending on the operating environment but has a maximum of 65535 bytes.
Datagram size: UDP checksums protect message data from tampering. The checksum value represents an encoding of the datagram data calculated first by the sender and later by the receiver.
Checksum :Should an individual datagram be tampered with or get corrupted during transmission, the UDP protocol detects a checksum calculation mismatch. In UDP, check summing is optional as opposed to TCP where checksums are mandatory.

Difference between TCP and UDP

TCP
UDP
Reliability: TCP is connection-oriented protocol. When a file or message send it will get delivered unless connections fails. If connection lost, the server will request the lost part. There is no corruption while transferring a message.
Reliability: UDP is connectionless protocol. When you a send a data or message, you don't know if it'll get there, it could get lost on the way. There may be corruption while transferring a message.
Ordered: If you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order.
Ordered: If you send two messages out, you don't know what order they'll arrive in i.e. no ordered
Heavyweight: - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together.
Lightweight: No ordering of messages, no tracking connections, etc. It's just fire and forget! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.
Streaming: Data is read as a "stream," with nothing distinguishing where one packet ends and another begins. There may be multiple packets per read call.
Datagrams: Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call.
Examples: World Wide Web (Apache TCP port 80), e-mail (SMTP TCP port 25 Postfix MTA), File Transfer Protocol (FTP port 21) and Secure Shell (OpenSSH port 22) etc.
Examples: Domain Name System (DNS UDP port 53), streaming media applications such as IPTV or movies, Voice over IP (VoIP), Trivial File Transfer Protocol (TFTP) and online multiplayer games etc
SMTP:
·         SMTP stands for Simple Mail Transfer Protocol. SMTP is a standard network protocol for transmitting messages to an email server on the Internet.
·         The SMTP format became the popular choice during the 1980s, at which time it was a complement to another technology known as UUCP (Unix-to-Unix Copy).
·          While UUCP was an excellent solution for handling email transfers going between intermittently connected computers, SMTP was found to be a much better option for sending and receiving emails on computers connected to a network permanently.
·         By 2001, approximately 50 different programs used SMTP as a client (which is responsible for sending emails) as well as a server (which receives these emails).
·         Originally, SMTP was an ASCII, text-based solution, which means there were problems with binary files – images for example.
·         Standards such as MIME (Multipurpose Internet Mail Extensions) were developed to allow binary files to be encoded and sent via SMTP.
·         All modern email client programs support SMTP. Web-based clients embed the address of an SMTP server inside their configuration, while PC clients provide SMTP settings that allow users to specify their own server of choice.
·         Because SMTP handles outgoing messages and not incoming ones, email clients require addresses of both an SMTP server and another server that processes inbound messages (usually, POP or IMAP).
·         SMTP uses TCP port number 25 for standard communication. To improve SMTP and help combat spam on the Internet, standards groups have also designed TCP port 587 to support certain aspects of the protocol.
·         A few Web email services, such as G-Mail, use the unofficial TCP port 465 for SMTP. Now-a-days Microsoft Exchange server is most popular.

FTP:
·         FTP allows you to transfer files between two computers on the Internet. FTP is a simple network protocol based on Internet Protocol and also a term used when referring to the process of copying files when using FTP technology.
·         To transfer files with FTP, you use a program often called the "client." The FTP client program initiates a connection to a remote computer running FTP "server" software.
·         After the connection is established, the client can choose to send and/or receive copies of files, singly or in groups. To connect to an FTP server, a client requires a username and password as set by the administrator of the server.
·         Many public FTP archives follow a special convention for that accepts a username of "anonymous."Simple FTP clients are included with most network operating systems, but most of these clients (such as FTP.EXE on Windows) support a relatively unfriendly command-line interface.
·         Many alternative freeware / shareware third-party FTP clients have been developed that support graphic user interfaces (GUIs) and additional convenience features.
·         In any FTP interface, clients identify the FTP server either by its IP address (such as 192.168.0.1) or by its host name (such as ftp.about.com).
·         FTP supports two modes of data transfer: plain text (ASCII), and binary. You set the mode in the FTP client.
·          A common error when using FTP is attempting to transfer a binary file (such as a program or music file) while in text mode, causing the transferred file to be unusable.



HTTP:
·         The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems.
·         HTTP is the foundation of data communication for the World Wide Web. Hypertext is a multi-linear set of objects, building a network by using logical links (the so-called hyperlinks) between the nodes (e.g. text or words).
·         HTTP is the protocol to exchange or transfer hypertext. HTTP defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands.
·         For example, when you enter a URL in your browser, this actually sends an HTTP command to the Web server directing it to fetch and transmit the requested Web page.
·         The other main standard that controls how the World Wide Web works is HTML, which covers how Web pages are formatted and displayed.
·         HTTP is called a stateless protocol because each command is executed independently, without any knowledge of the commands that came before it.
·         This is the main reason that it is difficult to implement Web sites that react intelligently to user input. This shortcoming of HTTP is being addressed in a number of new technologies, including ActiveX, Java, JavaScript and cookies.
·         HTTP - the Hypertext Transfer Protocol - provides a standard for Web browsers and servers to communicate.
·         The definition of HTTP is a technical specification of a network protocol that software must implement. HTTP is an application layer network protocol built on top of TCP.
·         HTTP clients (such as Web browsers) and servers communicate via HTTP request and response messages. The three main HTTP message types are GET, POST, and HEAD.
·         HTTP utilizes TCP port 80 by default, though other ports such as 8080 can alternatively be used.
·         The current version of HTTP in widespread use - HTTP version 1.1 - was developed to address some of the performance limitations of the original version - HTTP 1.0. HTTP 1.1 is documented in RFC 2068.

1 comment:

Kale Co Jakim said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai