1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
{
"metadata": {
"name": "",
"signature": "sha256:3bb6fed41815ab02f5db449f0fb6dc3bca89d7411c6822dfe382fccc1777b7c3"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 14: Mobile Network and Transport Layer"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.1, Page 452"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"O=800*1000; #Object size(Bytes)\n",
"S=536.*8; #max Segment Size(in bits)\n",
"RTT=0.1; #Round trip-time in sec\n",
"R=1.*10**6; #Transmission rate of the link from the server to the client in bps\n",
"\n",
"#Calculations\n",
"Lmin=2*RTT+(O/R); #latency(msec)\n",
"# For minimum latency (S/R) +RTT -(W*S/R) = 0;Therefore\n",
"W=1+(RTT)/(S/R);\n",
"\n",
"#Results\n",
"print 'The minimum possible latency is %d sec'%Lmin;\n",
"print 'The minimum window size is %.1f segments'%W;"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The minimum possible latency is 1 sec\n",
"The minimum window size is 24.3 segments\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.2, Page 452"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"RTT=0.1; #Round trip-time in sec\n",
"MSS=536.*8; #Maximum segment size in bits\n",
"p=0.01;# packet loss probability for the path\n",
"RTO=5*RTT; #Retransmission time out(from eqn 14.2 on page 450)\n",
"\n",
"#Calculations\n",
"R=0.93*MSS/(RTT*math.sqrt(p));\n",
"RR=MSS/(RTT*math.sqrt(1.33*p)+RTO*p*(1+32*p**2)*min(1,3*math.sqrt(0.75*p)));\n",
"\n",
"#Results\n",
"print 'The upper bound of the throughput is %.4f Mbps'%(R*10**-6);\n",
"print 'The throughput with retransmission due to errors is %.4f Mbps'%(RR*10**-6);"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The upper bound of the throughput is 0.3988 Mbps\n",
"The throughput with retransmission due to errors is 0.3341 Mbps\n"
]
}
],
"prompt_number": 2
}
],
"metadata": {}
}
]
}
|