Practice · 1 of 2
Frame a continuous stream
CHALLENGE
Difficulty: advanced+25 XP
Real TCP delivers frames glued together and split apart. Implement static List<string> DecodeStream(byte[] streamBytes) that decodes ALL frames concatenated in one buffer (the common localhost reality: two writes arrive in one read), throwing ArgumentException if the stream ends mid-frame. The test concatenates three encoded frames into one buffer plus a truncated fourth, and expects two clean decodes then a throw... implement static List<string> DecodeStreamSafe(byte[] streamBytes) that returns all COMPLETE frames and ignores a trailing partial frame (the tolerant reader every real protocol needs).
Press Submit to check your solution.
Back to lesson: Practice: Networking drills