0 F
2006-11-07 16:07:41Z Temperature server at port 8023 reports 99.9 F
2006-11-07 16:07:51Z Temperature server at port 8023 reports 99.8 F
Overview 29
That 0.0 sample right after 100.0 looks suspicious. Perhaps there is a poor connection
at the sensor? But a few minutes later we see:
2006-11-07 16:10:21Z Temperature server at port 8023 reports 99.8 F
2006-11-07 16:10:31Z Temperature server at port 8023 reports 99.9 F
2006-11-07 16:10:41Z Temperature server at port 8023 reports 100.0 F
2006-11-07 16:10:51Z Temperature server at port 8023 reports 99.0 F
2006-11-07 16:11:01Z Temperature server at port 8023 reports 999.0 F
2006-11-07 16:11:11Z Temperature server at port 8023 reports 899.0 F
That doesn??™t look like a bad connection. Investigating at the embedded computer
confirms that the sensor and server program are working correctly.
It seems significant that troubles appear after the temperature reaches 100. But
our unit test for 212 passed. What could be wrong?
2.10 Failures explained
After some investigation we discover the defect: the incorrect code that caused the
failures.3 The client??™s receive buffer is only four bytes long (BUFLEN in the Client
class, Figure 2.5).We intended 40, not 4: a typographical error thatwas not caught by
the compiler, by inspection, or by unit testing. When the server sends more than four
characters, for example, 100.
Pages:
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