Several things could be wrong here, however I can't tell which one(s) it will be as you have shown only a fraction of the relevant code. Here are the main possibilities: 1. you may be invoking a receive with a small buffer; if you were to ask for one byte, then you would only get one byte. 2. you might have an encoding mismatch between sender and receiver. e.g. if the sender uses Unicode, regular characters would look like real (ANSI) bytes and NULLs intertwined; an 8-bit encoder would react badly on the NULLs. 3. what EndReceive returns is the number of bytes, not characters, hence char[] chars = new char[iRx]; is wrong. IMO you should use [EDIT] Encoding.GetString() right away to convert bytes into a string.[/EDIT] :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
modified on Friday, October 22, 2010 10:04 PM