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(....) { }}
TCP/IP buffering
Here is how I am currently reading from the socket:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement