sockets and tcp.pdf

30
 n University of Prishtina Faculty of Computer and Electrical Engineering Telecommunication Department Sockets and TCP Computer Networking Mentor: Students: Prof. Dr. Blerim Rexha Rreze Halili [rrezehalili@hotmail.com] Isuf Tredhaku [ faradi33@h otmail.com] Orges Tafilaj [orgestafilaj @hotmail.com] January 2012, Prishtina

Upload: gzim-dragusha

Post on 03-Feb-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 1/29

University of Prishtina

Faculty of Computer and Electrical Engineering

Telecommunication Department

Sockets and TCP

Computer Networking

Mentor: Students:

Prof. Dr. Blerim Rexha Rreze Halili [[email protected]]

Isuf Tredhaku [[email protected]]

Orges Tafilaj [[email protected]]

January 2012, Prishtina

Page 2: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 2/29

  Faqja2 / 29

Abstract

This seminar work deals with the role of Sockets and TCP (Transmission Control Protocol) in TCP/IP

 protocol suit.

By the fact that today, we use the TCP/IP protocols and Internet, not only for entertainment and information, but for our business by performing transactions, buying and selling products, and delivering services to

customers. And lot more services that Internet providers offer for their costumers, services those that areavailable to users by applications. And by the fact that we are continually extending the need for differentapplications, TCP/IP continually is extending the infrastructural support and reliability.But how this reliability is achieved? One of reasons here is network configurations and huge role playsTCP/IP protocol suit.

And if we talk about reliability implemented in TCP/IP, the first thing we have in mind is TCP protocol.As we said this will be the subject of our work here.

In the first chapter we have given a useful explanation for TCP/IP in general, and the role of protocols.Then the second chapter deals with the role of Socket in transport layer of TCP/IP.

Part of transport layer, TCP presents one of the most successful protocols that provides secure transmission, basic data transfer, reliability, flow control, multiplexing, byte stream and full duplex data transfer. This is

the reason why we have continued with TCP explanation and its performance. This is achieved by separatingits characteristics in number of parts in third chapter.

In every part we have tried to give a simple, logical, and useful explanation. This is the reason that this textdespite being a seminar, with which our group will be estimated, several features here are designed to makeit particularly easy for students to understand Sockets and TCP , from our point of view.We would be honored if we have achieved this even in a small level.

Page 3: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 3/29

  Faqja3 / 29

Contents

1  Introduction................................................................................................................................ 4 

2  Socket ....................................................................................................................................... 6 

Transport control protocol - TCP .................................................................................................. 9 

3.1  Connection oriented ............................................................................................................. 9 

3.2  Segment of TCP ................................................................................................................ 11 

3.3  Connection establishment ................................................................................................... 14 

3.4  Retransmission techniques .................................................................................................. 16 

3.4.1  Variable intervals timeout ............................................................................................... 17 

3.4.2  Doubling the time interval ............................................................................................... 18 

3.5  Flow Control and Receiving Windows ................................................................................. 19 

3.6  Congestion Control ............................................................................................................ 21 

3.7  Termination of connection .................................................................................................. 24 

3.8  Configuration of TCP ......................................................................................................... 25 

Conclusion ..................................................................................................................................... 26 

Bibliography .................................................................................................................................. 27

Appendix 1………………………………………………………………………………………………........28

Appendix 2……………………………………………………………………………………………………29

Page 4: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 4/29

Socket and TCP

Faqja4 / 29

1  Introduction

In everyday life we face up with a lot of different applications, which we use for different purposes.Every time we ask for the best from them, great performance in every aspect. In this way we perform

with different, secure, fast, reliable, and attractive tasks.To sum up, these applications are changing the way we learn, live, enjoy, communicate, interact etc.The modern life activities are getting completely centered around or driven by the Internetapplications.

This is the reason why so many people are taking advantage of opportunities presented by Internet.This created a huge demand for software designers and engineers with skills in creating new Internet-enabled applications or porting existing/legacy applications to the Internet platform. The key elementsfor developing Internet-enabled applications are a good understanding of the issues involved inimplementing distributed applications and sound knowledge of the fundamental network programmingmodels. [KC] 

In this way, we can separate people in two groups. The first group are those who are not interested in

the way that those applications are available, just search for the best from them, and do not hesitate to pay for. And the other part, who in fact understand quite well the logic of this business (if we can callin this way) and are interested to attract the first part with different services, always trying to offersecure services, and attractive, and they do not hesitate to be paid for this too.

But how is it possible? We are working in a project, while we surf in a web, send a letter to our friend(maybe to tell that we can not go out tonight, because we have to finish the project), download a lot ofmaterials for our task and a lot of other things. 

In fact there are thousand of processes that are performed in our computer, and a lot of others innetwork, that make possible this. And all this stuff is regulated by the number of rules that we call

 protocols.In our case those rules are defined by OSI model, to be more specific TCP/IP (Transport Control Protocol/Internet Protocol ) protocol suite.The TCP/IP model includes a number of protocols to insure proper communication betweencorresponding layers of networked machines Fig1.1.

Fig.1.1 TCP/IP Protocol layers

Page 5: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 5/29

Socket and TCP

Faqja5 / 29

As we can see there are seven layers, and for this, questions often are about the use of layered

 protocols. Why do we need those layers? And the best way to answer, is taking a simple example.

Two persons want to communicate with each other, and to achieve this they need to speak in the sametransmission medium, and use the same language.In this way the communication can be seen as a structure with several layers. In the brain layer we

think about what we are going to talk, we prepare the concept for the language layer, which uses the below layer (the mouth) to produce the sound.

Sound waves use transmission medium to arrive to the destination, where the ear receivesthe sound waves, the language is interpreted, and brain receives the information sent by the other person.

Fig.1.2 Communication

In the same logic work the TCP/IP layers. As we can see from the Fig.1.1 the top layer of TCP/IP isthe Application layer.The application layer is provided by the program that uses TCP/IP for communication. An applicationin a user process cooperating with another process usually on a different host (there is also a benefit toapplication communication within a single host). [IBM 2001]

This includes all processes that use Transport layer protocols to deliver data to the Internet layer.Placed between the Application and Network layer, Transport layer has the task to perform the logical

communication between application processes of different or same host. This host can be directlyconnected to it, or may be very far away, and needs to pass routers and a lot of links for thedestination. But how does the Transport layer of the TCP/IP model prepare user data for transmission

to the network? What are some of the issues surrounding Transport layer configuration, management,and troubleshooting?

Here we can see the importance that Transport layer has. And in this task we face up with the notion

“socket”, which we are going to explain below. 

Page 6: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 6/29

Socket and TCP

Faqja6 / 29

2  Socket

Applications involve networking services provided by the transport layer, which is part of the Internet

software stack, often called TCP/IP stack , shown in Fig. 1.3. The transport layer can be one of the twotypes of protocols, TCP (Transport Control Protocol) and UDP (User Datagram Protocol).

So we mentioned applications data, and we mentioned transport of these data, but how do we knowwhich application protocol should data proceed when it comes from the network layer, how those data

will go to the user interface, and how the user will be able to see this.And why not to ask for the opposite too?What happens when the user has to send something to network, how the data will find their route or

 path to continue?The fact is that every computer has its own IP address; however, computers often need tocommunicate and provide more than one type of service, or to talk to multiple hosts/computers at atime. For example, there may be multiple FTP sessions, web connections, and chat programs all

running at the same time. To distinguish these services, a concept of ports is used.Port is a logical access point, represented by a 16-bit integer number. This means that each service

offered by a computer is uniquely identified by a port number.

This is the reason why each packet contains the IP address and the port number on the host in whichthe packet was destined.Just think about this, IP addresses is the house address when a letter is sent via post office, and portnumber in the name of a specific person that has to read the letter (it is his letter).

We have come to the fact that packets have IP addresses and port numbers that are useful for thedestination place. This combination of both those, IP address and port number creates a so called

“socket” address. 

Fig.2.1 Socket address

The two processes communicate with each other by sending and receiving messages through their sockets. A process's socket can be thought of as the process's door: a process sends messages into, and

receives message from, the network through its socket.When a process wants to send a message to another process on same/another host, it shoves themessage out its door, or out of its socket. [JKKR 2010]

In this way the server A, which is connected with a client B, can stay and wait for client’s request,

mean time can open e connection with another one, in a different port number, so the server has to usedifferent socket now. Fig.2.2.

Furthermore a socket is an endpoint of a two-way communication link between two programs runningon the network. This is the only way how the transport layer protocol can know where data aredestined.

Page 7: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 7/29

Socket and TCP

Faqja7 / 29

Fig.2.2 Establishment of path for two-way communication between a client and server

By the last sentence we can add too that socket is used like an Application Programming InterfaceAPI.

Interface to what? In our case, it is an interface to use the network, provided by operating system. Wecan see this in Fig.2.3.We can imagine socket like software methodology, a single connection between exactly two pieces ofsoftware that we use to connect different processes (programs) on the same computer or on differentcomputers.This looks like “plugging in” process into another process’s socket, with the tendency to make possible talking by writing and reading the socket. Fig.2.4.

Fig.2.3 Application layers and the interaction with socket

Within the operating system and the application that created a socket, the socket is referred to by a

unique integer number called socket identifier  or socket number . The operating system forwards the

 payload of incoming IP packets to the corresponding application by extracting the socket address

information from the IP and transport protocol headers and stripping the headers from the application

data.

Page 8: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 8/29

Socket and TCP

Faqja8 / 29

Fig.2.4 Socket mechanism

2.1  Types of Internet Sockets

The fact is that we have different type of socket, not many, but while we are talking about TCP/IP protocol suite, we are going to talk more about Internet Socket.Internet socket can be:

Datagram

Raw

Stream

The first category we refer a “connectionless socket ” too, by the reason that we just form a socketwhile it puts the packet in the destined place, and here is the end, it does not care any more for the packet route. It can be lost during transmission or received out of order, but it is the application's

responsibility and not the socket's to deal with these problems. It supports UDP protocol.The second type is Raw socket, that supports standard protocols like TCP and UDP. Raw sockets are

used for custom low-level protocol development.The third type is stream socket, and in the same time represents the most commonly-used type. Thisthanks the fact that stream sockets are reliable, two-way connected communication, and implement"connection-oriented" semantics.Before any data pass through, the connection is established, and then it’s time for data. This will result

with secure arrive of packet and in correct order.How do stream sockets achieve this high level of data transmission quality? They use a protocol called

"The Transmission Control Protocol", known as "TCP", which we are going to explain more.

Page 9: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 9/29

Socket and TCP

Faqja9 / 29

3  Transport control protocol - TCP

TCP- Transmission Control Protocol is a standard protocol with STD number 7. TCP is described by

RFC 793 [RFC 793]. Its status is recommended, but in practice, every TCP/IP implementation that isnot used exclusively for routing will include TCP. [IBM 2001].

TCP provides a one-to-one, connection-oriented, reliable communications service, byte stream and fullduplex data transfer.

This protocol establishes connections, sequences and acknowledges packets sent, and recovers packetslost during transmission. Using flow control, timers, congestion control ensures safe delivery of dataand in correct order.

In one sentence, performs reliable data transport services between process above the IP layer that isunreliable and produce that what we call “best effort”.  TCP protocol has strict error-detection algorithms built in to ensure the integrity of the data.All these and lot more function we are going to describe below, from the first action that is taken in

the TCP tasks. This will help us to understand the r easons of this TCP’s performance, and explain howthis is achieved. First of all we are going to describe the notion connection oriented, one of the most

important features of TCP.

3.1  Connection oriented

What dose this mean “connection oriented”? With connection-oriented protocol, a connection must beestablished with the communication partner before exchanging data. This means that before sending

appropriate data the sender and receiver should proceeds with a control information called “ three-wayhandshake”. This method

Is highly reliable

Requires more computational processing.

Continuing with our previous example, the persons that are taking and exchanging information with

each other, are aware for this, and their response is ready when the other one finishes his sayings.

Fig.3.1 Connection Oriented protocol

So both, the sending and receiving applications must interact with their operating systems (OS). Thisinteraction is useful because the OS should set up whatever is necessary for communication to take place.

Using TCP means creating a virtual connection between two TCP-s to send data. But be careful not toconfuse this with circuits switch or virtual circuit transport method, because TCP is just part of hosts,

end systems, and its performance dose not influence the elements between them. TCP protocol istotally part of end system, and intermediate elements communicate with different protocols.

Page 10: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 10/29

Socket and TCP

Faqja10 / 29

So here we start, one host A that we call client want to start a connection with the other host B that we

call server. (We are going to use host A and host B quite often so get used with it)

Host A begins the connection by sending host B a segment (special name for type of data being in TCPlayer, that we will explain later) with the "Synchronize sequence numbers" (SYN) bit set.This segment tells host  B that  A wishes to set up a connection, and it tells  B what sequence number

host A will use as a starting number for its segments. (Sequence numbers are used to keep data in the proper order.) Host B responds to A with a segment that has the "Acknowledgment" (ACK) and SYN

 bits set. B's segment acknowledges the receipt of A's segment, and informs A which Sequence Numberhost B will start with. Finally, host  A sends a segment that acknowledges receipt of B's segment, andfrom the last transfer, third stage can transfers the first actual data. [O’Reilly]. Fig.3.2.  

Fig.3.2 Three way handshake

But each data that have to be transmitted by the transport layer, comes after the demand made by

application layer. But how TCP knows what should be transported, and is this important for this protocol layer?In fact TCP dose not know what is written by application layer, it takes the data in a stream throughthe socket and divide them in independent way. In this way TCP will take chunks of data from thesend buffer, and add to them the TCP header. This process will create a TCP segment.The maximum amount of data that can be taken and placed in a segment is limited by the Maximum

Segment Size (MSS). The MSS depends on the TCP implementation (determined by the operating system) and can often be

configured. Here is important to achieve the fact that after encapsulation in IP will fill into a singlelink-layer frame, which is specified by MTU (maximum transmission unit), common values for MTUare 1,500 bytes, 536 bytes and 512 bytes. [JKKR 2010]So in this way between different processes, TCP creates an environment in which seems to be

connected by an imaginary "tube" that carries their data across the Internet.Fig.3.3.

Fig.3.3 Streaming transportation between processes

Page 11: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 11/29

Socket and TCP

Faqja11 / 29

In fact after segmentation this would continue to the network layer where would be encapsulated in IPdatagram, and then achieve the destination where would pass through the opposite action explainedabove.With stream data transfer, TCP delivers an unstructured stream of bytes identified by sequencenumbers. This service benefits applications because they do not have to chop data into blocks before

handing it off to TCP. Instead, TCP groups bytes into segments and passes them to IP fordelivery.[CIS 2011]

So data coming from the application is referred as a flowing stream. Data can flow fast or slow. Toinsure efficient flow of data to and from the application, TCP provides both input and output buffers.TCP has to think where to put bytes that come from above, and want to take the way to network, it justcan not answer everyone in immediate way.

In the Fig.3.4 we have taken a simple example how this all works. There are two buffers, the sending buffer and the receiving buffer, one for each direction. Normally the buffers are hundreds or thousands

of bytes, but we have taken a symbolic small number just to explain how it works. We also show the buffers are in the same size, which is not always the case. In the sending buffer we have the colored

 part of the sectors, when we put bits that have been sent but we have not accept jet the confirmationfor correct arrive in destination process.And the other part of the buffer, when we have bits, that should be put in the segments and sent to

network.The operation of the buffer at the receiver site is simpler. We have the part that is white and waits for

 bytes from source, and the colored sectors that contain received bytes that can be read by the receiving process. When a byte is read by the receiving process, the sector is recycled and added to the pool ofempty sector.

Fig.3.4 TCP segments and buffers

3.2  Segment of TCP

As we have explained earlier, when a stream of bytes comes from the application layer this can not besend in this way in network layer, but should be sent in packets.

So the data handed to TCP for transmission is known as a  stream; more specifically, an unstructured stream.

A stream is a flow of bytes of data and an unstructured stream is an unknown type of data flow of bytes. [MN 1999]This is the reason why the transport layer, (in our case TCP), groups a number of bytes and form a

 packet, that in TCP we call segment. But what we see in this segment? How this is made off and what

Page 12: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 12/29

Socket and TCP

Faqja12 / 29

does it contains? This is the subject of this part where we are going to talk more about structure of the

TCP segment.

Fig.3.5 TCP segment structure

As we can see in the Fig.3.5 the segment structure of TCP that contains:

The segment consists of a 20- to 60-byte header, followed by data from the application program.

Source port address. This is a 16-bit field that defines the port number of the application program inthe host that is sending the segment, which we use to multiplex/demultiplex the data from the upperapplication layer.

 Destination port address. This is a 16-bit field that defines the port number of the application program

in the host that is receiving the segment, and has the same function like source port, mux/demux theapplication data.

Sequence number field. As we have said before TCP view data as unstructured, ordered, and stream of bytes, that is the reason that to achieve connectivity, each byte that has to be transmitted, is numbered.[JKKR 2010]

The sequence number filed tells the destination which byte in this sequence is the first byte in thesegment so we use too to reassemble data in the order in which it was sent.During connection establishment, when we do not posses data, it uses a random number generator to

create an initial sequence number (ISN), which is usually different in each direction. This is 32 bitlong.

 Acknowledgment number. What TCP is characterized, is reliability of data transferred, and one of themain reasons for this, is the acknowledgment technique that uses TCP. This 32-bit field defines the

 byte number that the receiver of the segment is expecting to receive from the other party. If thereceiver of the segment has successfully received byte number  x from the other party, it defines  x + 1

as the acknowledgment number. Acknowledgment and data can be piggybacked together.

Page 13: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 13/29

Socket and TCP

Faqja13 / 29

 Header length. This 4-bit field is the part that tell the number of 4-byte words in the TCP header. As

we said before this value can be between 20 and 60 bytes. It indicates where the TCP header ends andthe data begins.Unused field. Is this part that makes possible to change the value of TCP header, and we let this like areserved. We can use in the future, but for now they must be zero.

Control or flag field . This field defines 6 different control bits or flags as shown in fig 1.x. One or

more of these bits can be set at a time. A brief description of each bit is shown in Table 3.1.

Table 3.1

Even from the table we can see that the URG bit tells that the sending part of application has put datathat are considered urgent.ACK bit is used to tell that the data received from the acknowledgment is valid.PHD bit we use when we need to tell the destination that data should pass immediately in theapplication layer.RST we use to reset the connection. One function for this is to not accept a connection request.

SYN we use to synchronize sequence numbers, and FIN to terminate the connection, no more data forreceiver. [BFSF 2007] Receive window. The field that is 16 bit field long means that the maximum size of the window is

65,535 bytes, but this can be decided by the receiver. We use this field for flow control that we willexplain later.

 Internet checksum. This field is used to detect errors over the entire user.Urgent data pointer . This l6-bit field, we use when the urgent flag is set, and defines the number thatmust be added to the sequence number to obtain the number of the last urgent byte in the data section

of the segment.Options filed  we use when we negotiate the number of TCP header.

Flag  Description 

URG The value of the urgent pointer field is valid. 

ACK The value of the acknowledgment field is valid.  

PSH Push the data. 

RST Reset the connection. 

SYN Synchronize sequence numbers during connection. 

FIN Terminate the connection. 

Page 14: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 14/29

Socket and TCP

Faqja14 / 29

3.3  Connection establishment

 Now after we have done the TCP segment, we are ready to put the segment in network, which meanswe are ready to start communication with the other part.

As we have said TCP connection is connection oriented and full-duplex too, which means that when a

host A, in fact application layer data A send data to application layer data of host B, in the same timeapplication layer data in host B, can send data to application layer of host A.

In the first sight this sound really mess, confusing and the very little chance of control and achievereliable data transfer, but the functions taken here are very simple. These functions include OPEN andCLOSE a connection, SEND and RECEIVE (information) to that connection, and STATUS to receiveinformation for a connection.In general this is like this: send a packet and then wait for an acknowledgment from the receiver,

 before sending the next packet. If the ACK is not received within a certain amount of time, retransmitthe packet. Fig.3.6.Furthermore TCP protocol provide “point to point” communication”, bur not “point to area” (a singlesender and more receivers).

Fig. 3.6 Connection principles

We start with the “three way handshaking” process that we have mentioned earlier too, this to achieveconnection establishment.Just to make a digression here, we have to make a difference between a passive and active connection.See Fig.3.7.

When the server program tells its TCP that it is ready to accept a connection, is called a request for a

 passive open.And when the client program issues a request for an active open .A client that wishes to connect

to an open server tells its TCP that it needs to be connected to that particular server. [BFSF 2007]

Fig. 3.7 Active and Passive open

Page 15: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 15/29

Socket and TCP

Faqja15 / 29

After connection is established, bidirectional data transfer can take place. The client and server can both send data and acknowledgments.Despite the fact that sequence numbers are put in random manner in TCP header, they have importantrole, by the fact that they have the control of putting data in the proper order and make possible to

evident if some of segment are missing. Furthermore sequence numbers speak about bytes in TCP andnot packet, which fact enhance even more the security of data transfer.

Same are acknowledgment numbers.TCP uses acknowledgments to confirm the receipt of data segments. So Acknowledgment Segment(ACK) performs two functions:  positive acknowledgment and flow control . By its function we knowhow much data has been received, and how much more the receiver can accept. [O’Reilly 1999]. AndACK number speaks, about the bytes and not for packet, segment or datagram.

For example suppose that we have done with the “handshaking” and we are transferring datainformation. And the receiver buffer or the number of bytes that can have is 6000 bytes.

We will explain later the window concept, but for now is enough to know the main role of it.This tells the sender that can continue sending segments, as long as the total number of bytes that it

sends, is smaller than the buffer of bytes the receiver can accept.It will put as a sequence number 0 and will transfer 2000 bytes, which means the SEQ=0 andACK=2001 (ACK No. = sequence number + bytes read in the segment + 1).And as the receiver can have until 6000 bytes, will take them and send a segment back, which is formSEQ=2001, ACK=3001.

The sender will turn back the answer by putting in the SEQ=3001 ACK=4001. So in this way each byte will be transferred for sure. See Fig.3.8

Fig.3.8 TCP data stream

This way of working of TCP protocol in the transport layer makes that what we call fast and reliable

transfer, however not always happen like this.The fact that TCP performs above the unreliable layer like IP, and data pass through a lot of more paths, routers, links which makes TCP to look like a very little price of cake in this scenario, becausewhat TCP will do, if data has been lost during channel transmission.For example segments of above example are sent again, but after the sender has finished sending threesegments, has received just one acknowledgment ACK=2001, the second is missing.

The sender has received no acknowledgment for the bytes from 2001 on, but continues sending data aslong as it is within the window. If the sender fills the window and receives no acknowledgment, it

will, after an appropriate time-out, send the data again starting from the first unacknowledged byte.In fact the strategy used by TCP overcome even with this problem, but the way how it solve this weare going to explain in later sections below, by flow control, retransmission technique, and congestioncontrol.

Page 16: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 16/29

Socket and TCP

Faqja16 / 29

3.4  Retransmission techniques

Internet's connection oriented services are group of services that are reliable, and TCP we said beforethat is part of them. And one of the techniques that are provided by TCP to achieve reliability is

retransmission.

TCP is communication protocol that provides this aspect. As we have said before TCP perform intransport layer that is the layer above the network layer which is completely unreliable in this aspect.So how is possible to perform reliable services?Despite the famous phrase “The hardness of chain depends exactly on the hardness of his weakestlink”, TCP protocol has achieved to enhance the hardness of chain above the hardness of his weaknesslink.So the data sent in the network layer and finish in the transport layer can be taken with a enoughreliability. This of course is achieved by the acknowledgments and retransmissions.

If the receivers of the packet do not send back an acknowledgment, to prove that the packet is in thedestination where it was sent, the sender will transmit again that data packet. To sum up this action iscalled “retransmission”.So in this way services that use TCP protocol for their transport layer, are sure that their packets have

achieved that desired destination.If the packet does not arrive in the destination, or for different reasons is not in the correct place, thenthe sender will send packet again and will not be interested to learn what happed with the packet, if it

last, corrupted, or is late in its way to come to the destination. It is very simple the sender did not takethe ACK, that would prove the acknowledgment of the packet to the receiver, will send it again.

We will explain this technique better by one example that we are going to take, always with host Aand host B.( we told you that we are going to mention quite often these hosts, so do not get bored)Host A is sending a data packet P to the host B. Sequential number of the packet P is SEQ=92 and itwill contain eight bytes of data. If packet P will arrive to destination to the host B, then host A willwait for the acknowledgment ACK=100 from host B.

In fact host A will wait always for the ACK from host B, or to be more accurate will start waiting fromthe moment it sends the packet to the network layer.

But packets have lost during transmission, and of course we do not possess the ACK from B. The hostA do not lose time thinking (it can not think in fact), but retransmit the packet in the same direction.But what happened with the first packet? (Think about this, anyway I am sure you thought before)Maybe it has reached the destination, but its ACK has been lost during transmission, or its ACK is inits way to the destination to the sender, but maybe it is lost for sure. Maybe, maybe …stop. Happenedwhat happen we should continue. So what we have done, if the packet have been lost, the problem issimple we have sent this packet again and we are waiting for the ACK, we came to the point that weare just how we were in the beginning.

But if the packet is in the destination place and we have sent it again, host B now has two same packets. This is not reliable transfer but this is exactly duplication of packet! What is the role of TCP

in this part?Host B detects that packet P is the same with the packet taken before, and the same packet is in his buffer, so it discard it, and send another ACK to host A. Fig.3.9. Now we hope that ACK will get to the sender, and will continue with the other packets.

This will cause us too, because we have to carry on with the explanation further. Now we suppose that our host A have sent two data packets P1 and P2 one after other.Packet P1 is with SEC=92 and has eight bytes, while P2 has SEQ=100 and carries twenty data bytes.

Suppose that both of them have arrived to the destination. Host B send the ACK for both of them, butthey do not reach the destination inside the time that was expected. After this, host A resend the first packet and restart the timer again. If the second ACK arrive during this second timeout that wasrestarted by the host A, this packet will not be retransmitted. Fig.3.10.

But network is network and here can happen anything, for example what if both packets were sent, butthe first ACK is lost, but the second arrive within first timeout.

Just to be more accurate, host A have received the ACK=120, before the timeout ends.This proves that every byte until 119 is in the correct pace in the host B.

Page 17: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 17/29

Socket and TCP

Faqja17 / 29

So why to resend another demand for ACK=100? That is the reason why host A stays without going

anything.Fig.3.11.

.

Fig.3.9 Double packet at host B Fig.3.10 ACK 2 arrive in ACK 1 timer

Fig.3.11 ACK 2 has arrived before ACK 1

We mention here timer and timeout , what are these, in fact if you understood the retransmission

technique, you have an idea for what serve those, and why do we use them. But we are going to give aclean view for these concepts.

3.4.1  Variable intervals timeout

In the last discussion we talked about TCP’s capability how to know when to send a retransmission ofa packet. This is a fairly complex subject that will only be briefly discussed here.Since data runs on an Internet that has varying delays caused by routers and low- or high-speed

networks, it is nearly impossible to determine an exact timer delay for an acknowledgment.Every TCP implementation use an algorithm to put a timeout value to use for round trip time (RTT,

we are going to explain later) of the segments. To do this, TCP records the time at which a segmentwas sent, and the time at which the ACK is received.A weighted average is calculated over several of these round trip times, to be used as a timeout valuefor the next segment(s) to be sent. This is an important feature, because delays can vary in IP network,depending on multiple factors, such as the load of an intermediate low-speed network or the saturation

of an intermediate IP gateway. [IBM 2001]So how we create an algorithm? Despite the fact that Internet has very heterogeneous nature this time

is quite variable, this is the reason why we should record every packet time, from the moment it leavethe source host, arrive to the destination host, and turns back with a correct ACK. This time we call

Page 18: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 18/29

Socket and TCP

Faqja18 / 29

RTT, and we mention before the reasons that this time is not a constant, in fact is dynamic, and in this

way we have to take it.But here is the master here, we take every RTT and using this delta, TCP builds a sample round-tripdelay time. TCP uses this time to build an average time for a packet to be sent and an acknowledgmentto be received. When it calculates a new value from another sample, it will slowly change its timerdelay for the waiting of the ACK packet.

This sample with change from packet to packet, so we have to take an average one to use in general.Here we come with the notion EstimatedRTT, which is kind of average value for samples that we take

for RTT.And the expression for this is:

EstimatedRTT = (1-x) EstimatedRTT + x SampleRTT(1) 

We have written in the programming language. But we have done this, use just to explain thatEstimatedRTT takes the value of previusEstimatedRTT  and adds to this newest value taken lie

SampleRTT.The value of x is recommend to be taken x=0.125.

So here is the point after we have EstimatedRTT, we know the value after we will resend packet, sothis value is “timeout” (that I promised that we are going to explain), and if packet do not bring ACKthat we look for, we restart the timer again, which will start running from the EstimatedRTT valueuntil the end, where it will be zero.But we hope now the ACK is in correct place, in contrary we have to restart again. And if we repeat

again and again these demands, for ACK that we are looking for. Where is the role of TCP? We aregoing to cause congestion in network, we are going to lose the sense of fast transmissions, and cause

confusion here.But if we want our packet, we do not have another choice. (Only if somebody has found, and we stilldo not know).

3.4.2  Doubling the time interval

When we have resent a demand for ACK that we do not have, and the timeout is finished, we said before that we have to resend again. This in previous explanations would last forever if we have such problems, but we have TCP implementations that overcome this problem too.

TCP in such case would resend again, but would put another timeout interval. Of course you think thisis different because of formula (1), (I thought like this), but is not, TCP sets the reset timeout interval

twice that the previous one.If the first timeout interval was set 1 ms, and now the packet was not acknowledgment this will beanother value and will be 2 ms.And we have that famous question. What happen if this time for mentioned reasons growsexponentially, will we get the ACK ever?

But again, this is better implemented like this, because packet do not arrive in the desalination for noreason, they have to travel from routers to routers and from path to path, and is understandable that

they can meet congestion during their way, so they can be late, or even dropped. And if we continue tosend more requests for ACK, this part really gets worse.That is the reason why each TCP sender resends the demand for ACK later and later.But the last case that we have to mention here is the fact that, when TCP sender sends packet and thereceiver only resend the first ACK, the sender understands that is missing the second packet, and performs with the fast retransmission of second packet before the timeout expires. Fig.3.12.To sum up a retransmission occurs if the retransmission timeout expires or three duplicate ACK

segments have arrived.

Page 19: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 19/29

Socket and TCP

Faqja19 / 29

Fig.3.12 The retransmission of three packets

3.5  Flow Control and Receiving Windows

As we have mention before TCP connection has its own buffers in both sides, in the sender andreceiver. These buffers are used to maintain the packet data for a while.This fact tells that data packet stay in first seconds in the buffer, then they decide for their way throughspecific socket and pass to the specific application layer, where are read by application layer parts.

This time that data spend in buffer is for the reason that not always receiver application are ready toread data that come. For example application layer can be busy in another task while streams of datawant to make their path to it.

In these conditions we can not stay without thinking! How much should be the size of buffer, and arethere any possibilities that this buffer would full up with data until the border of it, before theapplication layer is ready to reads them?Well knowing that buffer is just a memory, and memories have specified capacity, the answer is positive!But here we have another overcome from TCP protocol, and the answer to this problem is FlowControl.

Flow Control is mechanism, which helps TCP layer to avoid overflow of the buffer in the

sender/receiver part.This task is performed thanks to a “feedback”, which minimize the data streams being sent from thesender to the receiver and all this depends on the free space that buffer posses.This kind of feedback which is information that receiver use to tell the sender for its free space we callReceiver Window. This information is carried in each packet that receiver send back to the sender.In this way, with this information and with the differences between last sent byte and last ACKed byte,

the sender is informed if the buffer is overflow or is informed for its capability to accept further bytesof data.And in the beginning we have said that TCP performs with streams data, which fact helps now because in any moment can stop their flown towards network. If the packet data size would beconstant, this action (stopping data flown) would cause uncontrolled transport of them, and for surewould cause mistakes in chopping them.

Page 20: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 20/29

Socket and TCP

Faqja20 / 29

Fig. 3.13 Recivere window and reciever buffer

However even this TCP protocol solution, in real condition can not overcome all problematicsituations that reality can produce. One of these situations that can happen we are going to explain

here.For example if the receiver buffer (remember host B), would become full, and the sender (host A)

would take this information then of course it would not send data anymore. In the first sight this looksthat we solve the problem. But for a moment the receiver buffer would become free, how the senderwill understand this?

By the sentences that we have written until now, we can understand that the only way that the senderknows about buffer condition in the receiver side is by the receiver window, which is placed in a data packet that the receiver sends to the sender.But when the sender doses not have to send data packet?! This means that the sender will never

understand that the buffer size has become free, and it can send the other data packet.This disability is overcame in a way that the sender always send a packet data even if they carries asingle bit, and when the receiver send back the ACK to the sender, the last(sender) takes the window

size and understands if has become free. Then if this has happened the sender continue to take more

data streams and make data packet for the receiver.Finally to sum up all this what we have written Flow control mechanism, that works thanks to thewindow size and in this way TCP protocol overcomes another chance to congestion, or uncontrolled packet transfer.

Fig. 3.14 TCP - Window principle applied to TCP

Page 21: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 21/29

Socket and TCP

Faqja21 / 29

Just to explain with a simple example in the fig.3.14. We have taken a graphical view that tells more

about window size.Where:• A: Bytes that are transmitted and have been acknowledged. • B: Bytes that are sent but not yet acknowledged.  • C: Bytes that can be sent without waiting for any acknowledgment.  

• D: Bytes that cannot be sent yet.  

3.6  Congestion Control

One of the big advantages that TCP has is the congestion control algorithm. The TCP congestionalgorithm prevents a sender from overrunning the capacity of the network (for example, slower WANlinks). TCP can adapt the sender's rate to network capacity and attempt to avoid potential congestion

situations.In a simple manner (as we trying from the start of this seminar) congestion can be explained with thissituation: a huge number of senders send packet data, with large speed in a constant network capacity.

This undoubtedly brings different problems like data bytes lost, latency in communication process. Bythe fact that these situations are quite present in network, there are a lot of jobs done to handle withthis problem.So this is the why we use the term “Congestion control”.

Several congestion control enhancements have been added and suggested to TCP over the years. Thisis still an active and ongoing research area, but modern implementations of TCP contain four

intertwined algorithms as basic Internet standards:

Slow start

Congestion avoidance

Fast retransmission

Fast recovery [IBM 2001]

One big problem that we face up here is when a big size of data bytes are sent through the links, is the big latency that is displayed because of ACK bytes that should be transported between sender andreceiver. This latency tries to infinite, when that size of data that pass through the link in based in link

capacity. You an see this in figure below. Fig.3.15.

Fig.3.15 Congestion control

Here we don have taken the fact of lost bytes in buffers and routers that the data bytes pass throughthe path to the destination. If we take into consideration even this fact, that when the data speed grows

Page 22: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 22/29

Socket and TCP

Faqja22 / 29

through the link, and the grow ness becomes in that point that cause that the data bytes in the router

can be processed less than the data that can achieve the buffer, then here it starts the problem.Depend on the size of buffer, after a while the data will start to get lost. In this way the sender have toretransmit again those data packet.In addition, how many data packet get lost in buffer, will cause the degrees of the communicationsystem.

Despite those all problems, which we have talked before, we have more. Ridicules but this is the truth.

This thank to the fact that data packet pass through a lot routers and different paths, but still some ofthem pass through more routers than others.If we have the time that we face with a lot traffic (so the packet data from host to host is quite large),the data packet that pass through less routers have more possibility to be saved in buffer, in contrastothers that have passed through more routers have less possibility to be saved.

While we are talking here until now, we are sure that the concept of the congestion control is beingclear, so we do understand that congestion control is TCP’s characteristic.

This can be explained further by a simple example that will help us to get a better view for thissubject.

During a normal transmission of the data packet from host A to host B, for a number of bytes we havetaken a ACK but for some of others bytes happens that their ACK is becoming late for a while.Meanwhile a sender can still send packet data under supposition that before data’s configurations are going to come in moments.But now TCP use congestion control, which is used to control the number of data packet sent and not

 being acknowledged.This control specifies a number in which is based on, and is used to know the number of data packetthat we can sent without getting a ACK form them, this specified number we call Congestion Window.With this number that is decided we degrees the possibility of losing data. But here is our question.How much this threshold should be?If this number is little, then we do not posses good use of link, the reason is that the number of datathat can pass through is small.

In contrary if we put this number larger one, this threshold would cause larger data place reserved in buffer, but this can result in data loss too, and we do not need this. So we have to put a correct numberthat will not cause these actions described above. That is the reason why this threshold is not aconstant, but is variable number, and it depends on the traffic size. So this threshold changes nonstopduring time.This number is configured in that way that in the beginning of transmission is small and it gets longertime by time, always tending to have all ACKs.When those ACKs start not to come back to the sender, so the packet data start to be lost in their wayto the destination, TCP degrees this threshold until it gets the ACKs that was searching for.

When this is achieved TCP start again to increase this number, threshold or window until has theability to maintain with the capacity.To be more accurate we will take an example here. We have host A and host B that we would like to

use here again. Lets suppose that the connection between them is established (handshaking procedureis finished), and in fact packet are in their way towards network.

By the fact that application process, host A, want to send data using the TCP protocol, this willmaintain Congestion control in this way.Divide the streams in segments, and send only the first segment in network, (his congestion window

has one segment). Then wait for ACK for the first segment. So here it comes ACK for the firstsegment, and host A send another two segments too( his congestion window now has 2 segments), and

after their ACKs reach destination in the A host, then host A send another four segments, (hiscongestion window now is four) and wait. Fig.1.22.

As a conclusion, we can say that the Congestion window is growing in exponential way. And this willcontinue growing in exponential way until the window congestion will reach the threshold, then itstops growing like this. Anyway it will not stop growing all, but now it will grow in linear way.

Page 23: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 23/29

Socket and TCP

Faqja23 / 29

Because, when it comes to the point that the TCP has passed the threshold, the congestion window

will free place just one by one, so when the destination host send back an ACK to the sender, thewindow congestion will have a free place.The TCP congestion window (cwnd) controls the number of packets/bytes that a TCP flow may havein the network at any time. A bulk application will always have data available to transmit. The rate itsends is therefore limited by the maximum permitted by the receiver and congestion windows. In

contrast, a variable-rate application may experience periods when the sender is either idle or is unableto send at the maximum permitted rate. This latter case is called application-limited. [GFIB 2011]

Fig.3.16 Exponential increase of window congestion

But imagine, until when the Congestion window will continue to increase?This window will continue to increase, until some of our packet that was been sent will not bring back

the ACK that sender is waiting for, normally during the timeout that the sender have put.In this case TCP protocol provides degrees of the threshold in exponential way too.

In our previous example the TCP protocol will degrees the threshold twice.In this way Congestion window will have place for one segment.After the threshold is passed, then congestion window will be increase in exponential way, after a

while it stars the procedure of linearity and continue in this way again and again. Fig.3.17.

Fig.3.17 Evolution of TCP's congestion window

Page 24: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 24/29

Socket and TCP

Faqja24 / 29

If we put all those that we have said until in a graphical view, we can see the grow ness completelyexponential in the beginning. Then we can see the linear grow after the first threshold, then again theexponential grow which differ very little with the previous linear.So here we can make an approximation, and take the last grow linear too.The first phase that is the face with exponential grown, we call slow start (the phase that data start to

flow). After the slow start, it comes the normal grown that we call additive. So both of them we calladditive-increase, multiplicative decrease (AIMD) algorithm that is implemented by TCP protocol.

This procedure we know like Tahos algorithm.For the same reason is used Renos algorithm but the last one (Reno) implements fast retransmissionmechanism too.What is fast retransmission mechanism?Fast retransmission avoids having TCP wait for a timeout to resend lost segments. So when the sender

send packet and the receiver sends three times ACK, the sender understand that the packet after thisACK has lost and send this back again.

There are different congestion control algorithm but TCP uses Renos one.

3.7  Termination of connection

Finally, TCP must be able to gracefully terminate a connection. We tried to explain every thing that

can happen during a connection when is used TCP as a transport protocol, but host A and host B willnot stay all life sending/receiving data packets, so in a moment there has to be a last

 packet sent. But how is this performed?First (do not worry here in fact is the end), any of the two parties involved in exchanging data (clientor server) can close the connection, although it is usually initiated by the client.This is done by using the FIN bit in the TCP header. And by the fact that the connection is full -duplex,each side (host A and host B) must be aware for this process.In our famous example, host A want to terminate the connection and start this by sending a packet to

host B with a FIN bit set.Host B take the packet and no longer accepts data from host A. Now host B can still accept data from

its application layer, to send to host A.Host A despite the fact that want to end the connection still acknowledge the application data fromhost B, it has to wait until the host B send a FIN bit set packet.Host A receive this FIN bit packet and send the ACK to host B. Host B take the ACK from host A,and now for sure, is the end. No more data are sent…anyway, until the next connection… (We are not going to talk about thesecond connection).

Fig.3.18 The termination of connection

Page 25: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 25/29

Socket and TCP

Faqja25 / 29

3.8  Configuration of TCP

To be able to use TCP services we need to be able to perform the configuration of this protocol, so we

have given a short description of this duty.Both sides of link source and receiver must be configured to support configuration of TCP.

This would make possible window scaling or the default of 65,535 bytes will apply as the maximumwindow size. In table below we have introduce useful steps for this task, and the explanation of thesteps.

To support ECN, the remote peer must be ECN-enabled because the ECN capability is negotiatedduring a three-way handshake with the remote peer.[CIS 2011]

Table 3.2.

Steps Command or Action Purpose

1 enable Enter your password if prompted.

2 configure terminal Enters global configuration mode.

3 ip tcp synwait-time secondsSets the amount of time the Cisco IOS software

will wait to attempt to establish a TCP connection.

4

ip tcp path-mtu-discovery

[age-timer {minutes |infinite}]

Enables Path MTU Discovery.

5 ip tcp selective-ack Enables TCP selective acknowledgment

6 ip tcp timestamp Enables the TCP time stamp.

7ip tcp chunk-size characters

Sets the TCP maximum read size for Telnet or

rlogin.

8ip tcp window-size bytes Enables ECN for TCP. Sets the TCP window size.

9 ip tcp ecn Enables ECN for TCP.

10 ip tcp queuemax packetsSets the TCP outgoing queue size.

Page 26: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 26/29

Socket and TCP

Faqja26 / 29

Conclusion

In this project we have tried to explain shortly Socket as a connection between application and transfer

layers, and TCP as a successful protocol in TCP/IP suit.

As we have promised in the beginning of seminar, we have tried to explain TCP protocol in a way

which, even for the reader who is not very familiar with such things, will find something interesting,

first to understand and then learn too. But, in the other hand, this doesn’t mean that the reader, who is

familiar with computer network, couldn’t profit anything from this project.

We have started this project with an introduction, in which we talked about the protocols of different

layers in general, and their logic of performing their tasks. Continuing with description of interface

 between two highest layers, which is called Socket and its important role.

 Next, we explained TCP protocol in some details. Starting with what does the TCP protocol do with

data packets, how does it realize the connection between processes in different hosts?, then describing

the techniques which TCP use to realize a reliable data transfer (especially retransmission techniques),which is one of the most important properties of TCP.

Finally, we treated some of the problems of these communications, and some of the mechanisms to

manage these, such as flow control and congestion control.

To sum up if the data are sent by TCP, it is absolutely sure that these data will go from source to

destination uncorrupted and in the right order.

If we don’t add anything else after this sentence, it can be predicted that TCP is an ideal solution for

communication. Unfortunately, this is wrong.

Always by the project, it can be seen that the techniques which are used by TCP, exactly those

techniques with which is achieved reliable data transfer, produce delays and other problems like this.These problems perhaps cannot be significant to transfer data, but surely these are absolutely

unbearable for audio and video content transfer (especially in real time communication). For these

reasons, TCP is not used in such forms of communication, and now the other rival, UDP comes to

scene.

But in our opinion, we think that the grown of hardware power, which has caused the development of

software possibility and other improvements too, will soon cause for TCP to overcome this problem.

By reaching the bit rate which is happening time by time, improvement in physical layer, we are

optimistic that TCP will soon perform with reliable and very fast  data transfer.

Page 27: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 27/29

Socket and TCP

Faqja27 / 29

Bibliography

[JKKR 2010]

[GFIB 2011]

[CIS 2011]

[IBM 2001]

[MC 2003]

[O’Reilly 1999] 

[BFSF 2007]

[MN 1998]

[SM 2000]

[SV 2002]

[BH 2001]

[NS 2006]

[KC]

[RFC 793]

James F. Kurose and Keith W. Ross, “Computer Networking A Top -Down

 Approach Featuring the Internet”, 2010.

G. Fairhurst, I. Biswas "Updating TCP to support Variable-Rate Traffic",December 24, 2011

CISCO " Configuring TCP" 16 November, 2011

IBM, TCP/IP Tutorial and Technical Overview, August 2001

, Adolfo Rodriguez, John Gatrell, John Karas, Roland Peschke,TCP /IPFundamentals for Microsoft Window, Microsoft Corporation,ibm.com  /redbooks, 2003

Craig Hunt, TCP/IP Network Administration, O'Reilly & Associates, 1999

Behrouz A. Forouzan, Sophia Chung Fegan, DATA COMMUNICATIONS AND NETWORKING, McGraw-Hill Forouzan Networking Series, 2007

Matthew G. Naugle, Illustrated TCP/IP, Wiley Computer Publishing, JohnWiley & Sons, Inc, 1998.

TCP/IP Network Administration, Sun Microsystems Inc., 901 San AntonioRoad, Palo Alto, California, 2000

Steven Low, TCP Congestion Control: Algorithms & Models,netlab.caltech.edu IPAM, 2002.

Brian "Beej" Hall, Using Internet Sockets, Beej’s Guide to NetworkProgrammingHYPERLINK "mailto:[email protected]" [email protected]  , 2001.

Nikhil Shetty, Socket ProgramminSocket Programming, GSI, EECS122Spring 2006.

Kameswari Chebrolu, Socket Programming, Dept. of Electrical Engineering,

IIT Kanpur

J. Postel, "Transmission Control Protocol", September 1981

Page 28: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 28/29

Socket and TCP

Faqja28 / 29

Appendix 1

 Abbreviations 

AIMD additive-increase, multiplicative decreaseAPI Application Programming Interface

DNS Domain Name System

ECN Explicit Congestion Notification

ECN Explicit Congestion Notification

FTP File Transfer Protocol

HTTP Hypertext Transfer protocol

IBM International Business Machines

IP Internet Protocol

ISN Initial Sequence Number

MSS Maximum Segment Size

MTU Maximum Transmission UnitOS Operating System

OSI Open System Interconnection

RFC Request For Comments

RTT Round Trip Time

SMTP Simple Mail Transfer Protocol

TCP Transport Control Protocol

UDP User Datagram Protocol

WAN Wide Area Network

Page 29: Sockets and TCP.pdf

7/21/2019 Sockets and TCP.pdf

http://slidepdf.com/reader/full/sockets-and-tcppdf 29/29

Socket and TCP

Appendix 2

List of Figures

 Number Description

1.1 TCP/IP Protocol layers

1.2 Communication

2.1 Socket address

2.2 Establishment of path for two-way communication between a client and server

2.3 Application layers and the interaction with socket

2.4 Socket mechanism

3.1 Connection Oriented protocol

3.2 Three way handshake

3.3 Streaming transportation between processes3.4 TCP segments and buffers

3.5 TCP segment structure

3.6 Connection principles

3.7 Active and Passive open

3.8 TCP data stream

3.9 Double packet at host B

3.10 ACK 2 arrive in ACK 1 timer

3.11 ACK 2 has arrived before ACK 1 

3.12 The retransmission of three packets

2.13 Recivere window and reciever buffer

3.14 TCP - Window principle applied to TCP

3.15 Congestion control

3.16 Exponential increase of window congestion

3.17 Evolution of TCP's congestion window

3.18 The termination of connection