Computer networks -- 2007-2008 -- info.uvt.ro/Laboratory 1
- courses 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13;
- laboratories agenda, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, evaluation, tools, repository.
Please consult Computer networks -- 2007-2008 -- info.uvt.ro/Laboratory agenda.
Communication / protocol definitions
- is a process by which two or more entities exchange information.
- represents a piece of information.
- is an entity which has some information (the content) and wants to make it available to another party (or parties).
- is the entity which should receive the information addressed to it.
- it represents the format in which the content is transmitted, it wraps the content, and usually contains identification information for both the sender and the receiver.
- it represents a third entity, or a mechanism which is used to actually transport the message.
- is a specification (a contract) that describes rules in which a communication process can take place.
Communication / protocol design principles
A communication protocol can be viewed as a set of conventions and standards that govern the connection and/or communication between two endpoints. In computer networks the protocol might offer features for:
- reliable communication (communication over an imperfect communication channel). This might cover message order, message integrity, etc.;
Basically a protocol is a set of rules assuring that communication between one or more endpoints works properly.
Basic principles behind network protocol
- A communications protocol needs to be specified in such a way that engineers, designers, and in some cases software developers can implement and/or use it. This is generally achieved by layering protocols, by dividing the protocol in smaller parts, with interactions between then in a specific, well defined way.
- Assuring reliability of data transmission involves error detection and correction, or some means of requesting retransmission.
- Addresses a form of network failure known as topological failure in which a communications link is cut, or degrades below usable quality.
It is difficult to generalize about protocols because they vary so greatly in purpose and complexity. Most protocols address one or more of the following issues:
- detection of the underlying physical connection, or the existence of the other endpoint or node;
- negotiation of various connection characteristics;
- starting or ending a message;
- how to encode a message;
- what to do with corrupted, improperly formatted (error correction) or out-of-order messages;
- how to detect unexpected loss of the connection, and what to do next;
- termination of the session or connection;
Communication / protocol types
Ordered vs unordered
- it implies that the order in which the data is received, is the same one in which the data was sent;
- it is applicable in cases when there is a relation between transmitted data (when in order to process a piece of received data we also need all the data which was sent before that);
- it is mainly used with stream oriented protocols (for example wikipedia:TCP and generally all the protocols based on it);
- it does not imply that the order in which data is received, is the same one in which it was sent;
- its main application is for those cases when there is no relation between transmitted data, or when the order is not important;
- it is mainly used with datagram oriented protocols (for example wikipedia:UDP);
Examples of ordered protocol usage:
- voice or video transmission: assuming that the media content is split in blocks, we must present (play) them in the correct order;
Examples of unordered protocol usage:
- large files download: provided that we split the files in blocks, it does not matter the order in which we receive those blocks, as long as we receive all of them, and we know the place (offset) of each one;
Reliable vs unreliable
- Reliability and unreliability of protocols does not refer to the fact that received data is (in part) the same that was sent, or otherwise said that it has or hasn't any errors.
- Thus it is assumed that the received data is correct and does not contain any errors.
- it implies that all data sent is received with no loss;
- it is usually used in conjunction with connection oriented, stream oriented and ordered communication / protocols;
- it does not imply that all the data sent is received, thus parts of the sent data could be lost;
- it is usually used in conjunction with connection-less, datagram oriented and unordered communication / protocols;
Examples of reliable protocol usage:
- again for file transfer it is mandatory to receive the entire content of the file;
Examples of unreliable protocol usage:
- voice and video transfer could be done through unreliable protocols, because if a small portion of data is missing, the end-users would not notice, and even if they notice, they can reconstruct the missing information from the context;
Connection-oriented vs connection-less
- A connection-oriented communication or protocol implies that the entities involved in the process establish a common session (connection), and that all further data exchange is linked to this session.
- It implies three phases:
- session (connection) establishment (opening) phase in which all entities agree to exchange data, (and usually establish an identifier for the resulting session);
- data exchange phase in which data is sent and received (usually tagged with the session identifier);
- session (connection) termination (closing) phase, in which no entity sends data, but ensures it has received all sent data, followed by destruction of the session;
- Connection-oriented communication does not imply either data ordering or reliability, but in most connection-oriented protocols they are provided.
- In contrast to the previous definition, a connection-less communication does not imply any relation between exchanged data, each exchange operation is treated individually.
- Usually conection-less protocols are unordered and unreliable.
Examples of connection-oriented protocols:
- file transfer protocols (HTTP, FTP);
Examples of connection-less protocols:
- DNS (Domain Name System);
- NTP (Network Time Protocol);
- routing protocols;
- wikipedia:Connection-oriented protocol
- wikipedia:Connectionless protocol
- wikipedia:Connectionless mode transmission
Stream vs datagram oriented
The main distinction between stream and datagram oriented protocols is the way they treat the exchanged data.
- Stream oriented
- Assumes no data boundry, treating the exchanged information as a flow of octets obtained by concatenating the sent data.
- This means that in order to exchange an amount of data, the sender could execute a different number of operations than the receiver.
- Datagram oriented
- all data sent / received in one operation is seen as a whole, obtaining an implicit data boundry. So this means that the data sent in one operation should be read in one operation.
Brief TCP/IP Introduction
The Internet Protocol (IP) is the method or protocol by which data is sent from one computer to another on the Internet. Each computer (known as a host) on the Internet has at least one IP address that uniquely identifies it from all other computers on the Internet.
When you send or receive data (email, web page, etc), the message gets divided into little parts called packets. Each of these packets contains both the sender's and the receiver's Internet address.
IP is a connectionless protocol, which means that there is no continuing connection between the end points that are communicating. Each packet is treated independently without any relation with other packets.
There are several other protocols used together with (more exactly over) IP in order to provide additional features, the most common ones are:
- TCP provides reliable, in-order delivery of a stream of bytes. TCP manages individual conversations between servers and clients. The protocol also handles congestions and message size.
- Using UDP hosts can send short messages named named datagrams between them. UDP does not guarantee reliability or ordering.
- wikipedia:Internet Protocol
- wikipedia:Internet protocol suite
- wikipedia:Transmission Control Protocol
- wikipedia:User Datagram Protocol
An IP Address is an, unique address used in identifying hosts using the Internet Protocol.
- Typical internet address
To make it easier for us humans to remember, IP addresses are normally expressed in decimal format as a "dotted decimal number" like the one above.
Both TCP and UDP use a special number present in the IP packet header to identify individual services, this number is named "port". The number of ports is restricted by the size of the corresponding field in the packet header (16 bits). Generally ports are mapped to specific programs that handle the corresponding requests.
DNS (Domain Name System) is a system for converting host names and domain names into IP addresses on the Internet or on local networks that use the IP protocol. For example, when a Web site address is given to the DNS either by typing a URL in a browser or behind the scenes from one application to another, DNS servers return the IP address of the server associated with that name.
The DNS also stores other information such as the list of mail exchange servers that accept email for a given domain.
In providing a worldwide keyword-based redirection service, the Domain Name System is an essential component of contemporary Internet use.
- One process / thread per client;
- Thread pooling;
- Non-blocking IO;
- Asynchronous IO;
- EDA, SEDA (optional);
- Message queues (optional);
- wikipedia:Berkeley sockets
- wikipedia:Asynchronous I/O
- wikipedia:Event-driven architecture
- wikipedia:Staged event-driven architecture
- wikipedia:Message queue
- wikipedia:Thread (computer science)