Game Development Community

TCPObject::parseLine not returning value when it hits the end file

by vincent kway · in Torque Game Engine Advanced · 05/31/2011 (9:56 pm) · 0 replies

Hi guys,

I found the function TCPObject::parseLine never process the value at the end of the file.

I change the code to make it process the last line by commenting out the if(...) condition inside the function:-

TGEA 1.8.2 tcpObject.cpp line 148

if(i == bufferLen || mBuffer)
{
// we've hit the end with no newline
...
...

// process the line
//if(i != bufferLen) <-------------- Comment this line
{
mBuffer[mBufferSize] = 0;
if(mBufferSize && mBuffer[mBufferSize-1] == '\r')
mBuffer[mBufferSize - 1] = 0;
U8 *temp = mBuffer;
...
...
}
...
...
}

Anyone facing the same problem before? Hope this fix helps.

Another solution to this is the return file always need to add a newline at the end of the file. But this fix should work for all.