tjiwe

tjiwe

  • NA
  • 5
  • 0

Significant characters i variables

Dec 18 2004 10:31 AM
Hi! I´m a total newbe to C# som my question migth seem stupid, but anyway. I've made a async tcp-client to connect to sip-server (selfcheck library services) I receive data like this: CSocketPacket theSocPkt = new CSocketPacket(); theSocPkt.thisSocket = m_socClient; // now start to listen for any data... m_asynResult = m_socClient.BeginReceive(theSocPkt.dataBuffer, 0, theSocPkt.dataBuffer.Length, SocketFlags.None, pfnCallBack, theSocPkt); Then I do this with it: CSocketPacket theSockId = (CSocketPacket)asyn.AsyncState ; //end receive... int iRx = 0 ; iRx = theSockId.thisSocket.EndReceive (asyn); char[] chars = new char[iRx + 1]; System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder(); int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0); System.String szData = new System.String(chars); StringBuilder sbData = new StringBuilder(szData); txtDataRx.Text = txtDataRx.Text + sbData; WaitForData(); Now to the problem, the reply from the server contains pipe(|) characters. As you can see I can make a string builder of the reply and it prints out nice but if I try to do something like sbData.Remove(2, 5) I get an error saying that Index is out of range although I know it aint. I know my description of the problem seems a bit confused but the bottom line is that I cant manipulate the string and I suspect that it is because it contains the pipe characters.

Answers (1)