<p>Kinda long title, but anyways...</p>

<p>I've been looking at these examples, specifically on the parts on writing and reading the size of the message to the byte streams<br>
<a href="http://doc.trolltech.com/4.4/network-fortuneclient-client-cpp.html" rel="nofollow noreferrer">http://doc.trolltech.com/4.4/network-fortuneclient-client-cpp.html</a><br>
<a href="http://doc.trolltech.com/4.4/network-fortuneserver-server-cpp.html" rel="nofollow noreferrer">http://doc.trolltech.com/4.4/network-fortuneserver-server-cpp.html</a></p>

<p>But I can't seem to figure it out in C#.</p>

<pre><code>StreamWriter writer = new StreamWriter(tcpClient.GetStream());
writer.Write(data.Length + data);
</code></pre>

<p>This doesn't work very well at all. Could someone give me a nudge in the right direction?</p>

Instead of
```
data.Length
```
, try:
```
```
writer.Write(chr(data.Length) + data);
```
```
This will prefix every data block with one byte indicating its length (up to 255 bytes long). As you requested, this is only a nudge. :)
Update: I just remembered that C# is all Unicode and stuff, so chr() probably gives you more than one byte. Adjust to fit.