ofxTCPClient receiveRaw() bug


Just posted this at the github (here: http://github.com/openframeworks/openFr-…-#issue/213)

I was getting garbled stuff back from the receiveRaw() method of ofxTCPClient, found the problem…

When you call receiveRaw() you get whatever is in ofxTCPClient’s internal tmpBuff, up to the first null, but the class gets its data from a method that reads bytes, not c strings - i.e. no null terminator, just an array of bytes and a length. So you just need to put the null in at the end.

string ofxTCPClient::receiveRaw(){  
    messageSize = TCPClient.Receive(tmpBuff, TCP_MAX_MSG_SIZE);  
    } else if(messageSize<TCP_MAX_MSG_SIZE) {  
        // null terminate!!  
        tmpBuff[messageSize] = 0;  
    return tmpBuff;