Calculate number of bytes sent in TCP session - tcp

I currently learn about TCP protocol and about 3 way-handshake. I cannot figure out how I can calculate the number of bytes transmited in this TCP session. I understand that in the first 3 and in the last 4 it's connection establishment and closing connection but between 4-11 I don't know to count the bytes
TCP session

Looking at frames 4 to 6 of your attachment:
172.20.1.21.1303 > 172.20.0.81.23: P 1:22(21) ack 1 win 65535
172.20.0.81.23 > 172.20.1.21.1303: P 1:13(12) ack 22 win 61299
172.20.1.21.1303 > 172.20.0.81.23: P 22:25(3) ack 13 win 65523
Frame 4 is from host A to B. The first number (1) after the 'P' flag is the (relative) sequence number of the first data byte of this segment, and the number in brackets (21) is the length of that segment in bytes.
Frame 5 is response from host B to A. The value after 'ack' (22) is host B telling host A that B has received bytes 1 to 21, and that it expects sequence number 22 next.
Frame 6 is the next segment from A to B. Sure enough, the sequence number is 22, which matches what B is expecting, and this time the length is 3 bytes.
If you then look at the final frames of the sequence, we can see in frame 12 that Host B has a sequence number of 1052, meaning it has sent 1052 bytes over the course of the connection (and the ack in frame 13 confirms this). Similarly, frame 14 shows that Host A sent 107 bytes (and the ack in frame 15 confirms this).

Related

Maximum number of communication in 5 ports router

I want to find a formula with it I can find the number of the communication that can occur at the same time (different combination) in f port router for network on chip.
In network on chip's router there are 5 port and each port has input and output.
5 is the maximum number of communication that can happen at the same time. Here an example:
input 1 -> output 2
input 2 -> output 3
input 3 -> output 4
input 4 -> output 5
input 5 -> output 1
I want to calculate how many combinaison I can have.
I could only figure out that the question is based on mathematics and has nothing to do with the networking and probability tags!
As you mentioned
In each port the input cannot communicate with other inputs and cannot communicate with the output in the same ports.
So, assuming one port communicating via input,
the port can communicate with only 4 output of other ports and not with the 4 input of the other ports and also not with the output of the same port.
So,net communication in this case while considering 5 inputs = 5*4 = 20.
Similarly,for the output case, the overall communications = 5*4 = 20.
Therefore,net communication done= 20 + 20 = 40.
If duplication while communicating is not considered(taken into account), then the total communication for input & output for all ports= 2 * 5 Combination 2 = 2 * 10 = 20.

Maximum throughput for a sliding window data transmission

I am trying to understand how to calculate the throughput for a sliding window data transmission, by solving some numerical examples. Below is the example followed by my analysis.
Example
Host A is sending data to Host B over a full duplex link. A and B are using sliding window protocol, with send and receive window sizes of 5 each. Data packets sent only from A to B, are 1000 bytes each in size, and transmission time for one such packet is 50 us. Propagation delay is 200 us. Assume Ack packets need negligible transmission time. What is the maximum achievable throughput in Mbps?
A. 7.69 B. 11.11 C. 12.33 D. 15.00
Analysis
Round trip-time is 2 * 200 us = 400 us. ... A
Time required to fill the sending window = window size (5) * transmission time of 1 packet (50 us) = 250 us. ... B
Since B < A, sender has to wait for ack to 1st packet before sending the 6th packet. This ack appears at 450 us. (round-trip time is 400 us.)
Between 250 us and 450 us, the sender is idle, that is no new data is being sent over the line.
Assuming sender has an unlimited supply of data frames, the above cycle would repeat.
Thus, in every 450 us, sender sends 5 packets = 5 * 1000 * 8 = 40000 bits of data.
Hence, throughput = 40000 bits / 450 us = 84.7710 megabits per second. (84.7710 Mbps)
However, this is not one of the given options, not even close! Is there any mistake in my analysis above?
As I stated in my comment, your analysis and calculation method is correct. However, I'd check my calculator if I were you because 40000 bits / 450 us = 88.88...Mbps, not 84.7710 Mbps.
I do not think it is mere coincidence that 88.88 is just 11.11*8, so it's a fair assumption that the question was actually asking to get megabytes per second instead of megabits per second.
Throughput = Window /RTT
Here Window size = 5*1000 bytes = 5000 bytes.
RTT = 50us + 2*200 us=> 450us.
Therefore Throughput= 5000 bytes/450 us = 11.11Mpbs

Total length in IPv4 header

I am trying to learn about IPV4 headers and used Wireshark to take a look at some packets.
The total length (header length + data length) is 76 bytes. The header length is 20 bytes and the data length is 24 bytes. Were is the other 32 bytes in the total length field coming from?
I think you're missing the TCP header. The data payload is indeed 24 bytes, IPv4 header is 20 bytes, TCP header must be (76 - 24 - 20) = 32 b.

How do I calculate IP-header length?

I want to calculate IP-header length with following statement:
Header Length is a four-bit field that tells, as the name implies, the
length of the IP header in 32-bit words
Now I'm getting difficulties in calculating IP header length (minimum and maximum), with four-bit field.
The minimum length of an IPv4 header of a valid datagram is 20 bytes, when the value reads 5 and there are no options
Since the field is 4 bits wide, the maximum value it can store is 15, thus the maximum length of the header is 60 bytes.
Internet Header Length is the length of the internet header in 32
bit words, and thus points to the beginning of the data. Note that
the minimum value for a correct header is 5.
Which means whatever value is stored in the IHL, it should be multiplied with 32 to get the total number of bits, or with 4 to get the total number of bytes.
minimum value of header length is 20 Bytes but we don't have sufficient bits to represent 20 so we use scaling technique, i.e. 0101 (5) will represent 4 X 5 = 20 Bytes, here scaling factor is 4.
maximum value possible with 4 bits is 15.
So maximum header length possible is 4 X 15 = 60 Bytes.
Header Length | Header Length Field
20 -----> 5
24 -----> 6
28 -----> 7
.
.
.
60 -----> 15
if header length is 22 Bytes then we use padding to make it a multiple of 4 i.e. 24 Bytes
#Amit>Value in the HL filed is = the number of 4 bytes in the total IP header length.Means if the header length field is say 40,then calculate how many 4 bytes in 40?its 40/4= 10.So value in the HL field is 10
MINIMUM HL value
Minimum HL is 20 byte .ie no of 4bytes in 20 = 20/4=5.So minimum value in HL field is 5.
MAXIMUM HL value
HL is a 4 bit field.so the maximum vale that can be accomadated in that field is 15(1111) or you can calculate using the formulae 2^4-1=15.So max no: of 4 bytes can be 15.Hence the Max header length=15*4=60bytes.
Hope now things are clear.
The Internet Header Length (IHL) field is the number of 32-bit words(=4 bytes)
in the IPv4 header, including any options. Because this is also a
4-bit field, the IPv4 header is limited to a maximum of fifteen 32-bit
words(=60 bytes)
So if the value of IHL is 0101(5), then the IP-header's length is 5*4(bytes) = 20(bytes)

Number of hosts in a subnet

Does anyone know how many host bits are needed to guarantee that a subnet could have 9 usable hosts?
I was thinking about around 4, but I'm not sure. Can some shed some light on this?
Two subnet addresses (all-ones and all-zeros) can't be used to indicate a host, so with N bits you get up to (2**N - 2) usable hosts. So, for 9 hosts, 4 bits is correct: it would do up to 14, but 3 bits would do only 6 hosts.
Here are networks that meet the requirement 192.168.1.0 /28
Mask:255.255.255.240 Host/Net - 14
Network Broadcast
192.168.1.0 192.168.1.15
192.168.1.16 192.168.1.31
192.168.1.32 192.168.1.47
192.168.1.48 192.168.1.63
192.168.1.64 192.168.1.79
192.168.1.80 192.168.1.95
192.168.1.96 192.168.1.111
192.168.1.112 192.168.1.127
192.168.1.128 192.168.1.143
192.168.1.144 192.168.1.159
192.168.1.160 192.168.1.175
192.168.1.176 192.168.1.191
192.168.1.192 192.168.1.207
192.168.1.208 192.168.1.223
192.168.1.224 192.168.1.239
192.168.1.240 192.168.1.255
We can calculate number of host bit by 2 methods:
We require 9 usable hosts
So converting 9 into binary we have 00001001.
Now,
128 64 32 16 8 4 2 1
0 0 0 0 1 0 0 1
count from right to left now, till the last on bit
so into 00001001 we have last on bit at 1
get the borrow bit till last on bit, that is 4
now for if we are calculating for class c , than the default subnet mask is
255.255.255.00000000
Now for calculation we off the bits where as for network we on the bit
so for host off 4 bits from right to left and on the rest left bits.
here 4 is the borrow bit that was calculated earlier
255.255.255.11110000
now taking only the last bit of subnet mask,
128 64 32 16 8 4 2 1
1 1 1 1 0 0 0 0
the increment value is 16
Note: increment value is calculated as last on bit from left to right.
so we will have a network of 128+64+32+16= 240
for class 'C' we have 192.168.1.0/28 or 192.168.1.0 255.255.255.240
number of host: 192.168.1.0
192.168.1.16
this is the first network, here we have 192.168.1.0 as network IP and 192.168.1.15 as broadcast IP
so from 192.168.1.1 to 192.168.1.14 are the usable IP or host that claculates to 14 usable host.
2nd method
we have the formula of claculating the host as 2^(n)-2
here n are off bits
from the 1st method we have number of off bit is 4
so 2^4 - 2= 16-2 = 14
hence we will get a slot of 14 usable host from which we can use 9
NOTE: The network class taken above is just an example which does not have any effect on increment bit calculation.Similarly we can calculate for class A and B

Resources