TCP/IP buffering

Started by
10 comments, last by xDS4Lx 15 years, 6 months ago
Here is how I am currently reading from the socket:

public void OnDataReceived(IAsyncResult asyn){    try    {         Socket theSoc = (Socket)asyn.AsyncState;                  int iRx = theSoc.EndReceive(asyn);         // get the number of bytes that were transmitted         char[] chars = new char[iRx + 1];         System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder();         int charLen = d.GetChars(dataBuffer, 0, iRx, chars, 0);         string strMsg = new string(chars);         WaitForData(theSoc);     }     catch(....)     {     }}

"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
Advertisement
I changed my write code to use the StreamWriter class and it seems to have fixed the problems!
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989

This topic is closed to new replies.

Advertisement