rtadams89:
I've been having some issues with my Arduino sketch (lock ups/slow response). I have fixed the lock up issue with some code cleanup, but the web page the Arduino serves up is still slower than I would expect. I decided to sniff the IP traffic between the Arduino and my network and was surprised to see a bunch of "malformed" packets. I've attached my sketch here for reference, [u]but I get these same malformed packets even when running a stripped down, simplified version of the sketch[/u]. I've also attached a pcap file containing the traffic coming from the Arduino (192.168.10.102) to the client (192.168.10.103).
The webpage loads, so these malformed packets aren't breaking anything, but I think they may have to do with the slowness.
Any ideas?
Malformed packets are COMPLETELY NORMAL, it is when wireshark does not have all the information to parse the full stream.
HOWEVER in your case
Use your wireshark,->analyze-> follow stream-> hex dump
00000000 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a GET / HT TP/1.1..
00000010 41 63 63 65 70 74 3a 20 74 65 78 74 2f 68 74 6d Accept: text/htm
00000020 6c 2c 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 l, appli cation/x
00000030 68 74 6d 6c 2b 78 6d 6c 2c 20 2a 2f 2a 0d 0a 41 html+xml , */*..A
00000040 63 63 65 70 74 2d 4c 61 6e 67 75 61 67 65 3a 20 ccept-La nguage:
00000050 65 6e 2d 75 73 0d 0a 55 73 65 72 2d 41 67 65 6e en-us..U ser-Agen
00000060 74 3a 20 4d 6f 7a 69 6c 6c 61 2f 35 2e 30 20 28 t: Mozil la/5.0 (
00000070 63 6f 6d 70 61 74 69 62 6c 65 3b 20 4d 53 49 45 compatib le; MSIE
00000080 20 39 2e 30 3b 20 57 69 6e 64 6f 77 73 20 4e 54 9.0; Wi ndows NT
00000090 20 36 2e 31 3b 20 57 4f 57 36 34 3b 20 54 72 69 6.1; WO W64; Tri
000000A0 64 65 6e 74 2f 35 2e 30 29 0d 0a 41 63 63 65 70 dent/5.0 )..Accep
000000B0 74 2d 45 6e 63 6f 64 69 6e 67 3a 20 67 7a 69 70 t-Encodi ng: gzip
000000C0 2c 20 64 65 66 6c 61 74 65 0d 0a 48 6f 73 74 3a , deflat e..Host:
000000D0 20 31 39 32 2e 31 36 38 2e 31 30 2e 31 30 32 0d 192.168 .10.102.
000000E0 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 4b 65 65 .Connect ion: Kee
000000F0 70 2d 41 6c 69 76 65 0d 0a 0d 0a p-Alive. ...
00000000 48 H
00000001 54 T
00000002 54 T
00000003 50 P
00000004 2f /
00000005 31 1
00000006 2e .
00000007 31 1
00000008 20
00000009 32 2
0000000A 30 0
0000000B 30 0
0000000C 20
0000000D 4f O
0000000E 4b K
0000000F 0a .
now go back to your packet window look at the first 'malformed packet' packet by selecting it and in you bottom window wire shark will have a list say:
Frame 5:60 bytes on wire
ethernet
internet protocol
transmission control ............... SEQ:1, ACK:252 , Len:1
HYPER TRANSFER PROTOCOL
now select "HYPER TRANSFER PROTOCOL" and look in the HEX dump at WHICH character is highlighted:
in this case it is a "H", now match it up with the hex dump above
move down 1 packet to frame 6 and it is a "T"
packet 7 is your client saying thankyou
8 & 9 is "T","P"
and so on..
so now you know that the "malformed packets " are not a 'problem' in so far as the content is correct, just some nutter(you ;)) is forcing the system to send HTTP requests one character at a time.....
wireshark is useful, but you must know how to interpret the output correctly.
Now all you need to do is re-jig your code and it will be faster than shit down a vertical slope.
HC