|
|
User login
Feeds |
TCP for begginer
|
|||||
| Thu, 2004-06-24 15:11 | |
|
I'm writing a Client on symbian , and Im tring to read data from the server , it sends a buffer , and I have problems reading it .
the code is as follow : /* first I read the length */ TBuf8<2> tmpBuf; iEchoSocket->Read(tmpBuf, iReadStatus); User::WaitForRequest(iReadStatus); TInt16 BufLen = BigEndian::Get16((TUint8*)tmpBuf.Pt()); /* now I need the all buffer - how should i do it ? */ Thanks . |
|
Forum posts: 28
First of all you should supply a bigger buffer if you need to reda more than 2 bytes!. I mean something like
TBuf8<2048> tmpBuf;
Tint NoOfBytesActuallyRead = 0;
iEchoSocket->Read(tmpBuf, iReadStatus);
User::WaitForRequest(iReadStatus);
NoOfBytesActuallyRead = tmpBuf.Length();
// You have this many bytes read in a single read operation.
// Now you can read first 2 bytes and find out the actual number of
// bytes still to be read so on based on the protocol used
hope this helps
murali