Hi, I'm not sure if this block is still being maintained or not but I just wanted to point out a very strange behavior I faced when making a simple messaging system with a libcinder app as a TCP Client and a node.js TCP server on LAN:
Modifying the TcpClient sample, I removed the mSession->close() line from the end of the onRead method because unlike the sample I wanted to keep my connection alive with the server for many hours. I replaced that line with a mSession->read() because I wanted the client to keep listening of course and I needed it there because I didn't necessarily write back to server after I read a buffer so I couldn't just keep the mSession->read() at the end of the onWrite() method. I still kept that though so that the client could keep listening after every time it wrote a message to the sever. But as my code evolved I noticed that sometimes the client read an empty buffer in onRead() whereas it should have read a message. I played around with the code and realized that removing mSession->read() from onWrite mitigated the bug! Should that be the case? Why would having 2 read() calls on the session conflict each other? Is that an expected result or was I doing something wrong? On the whole, why do we need to say mSession->read() every time and can't we have a client that is constantly listening/reading?
Hi, I'm not sure if this block is still being maintained or not but I just wanted to point out a very strange behavior I faced when making a simple messaging system with a libcinder app as a TCP Client and a node.js TCP server on LAN:
Modifying the TcpClient sample, I removed the
mSession->close()line from the end of theonReadmethod because unlike the sample I wanted to keep my connection alive with the server for many hours. I replaced that line with amSession->read()because I wanted the client to keep listening of course and I needed it there because I didn't necessarily write back to server after I read a buffer so I couldn't just keep themSession->read()at the end of theonWrite()method. I still kept that though so that the client could keep listening after every time it wrote a message to the sever. But as my code evolved I noticed that sometimes the client read an empty buffer inonRead()whereas it should have read a message. I played around with the code and realized that removingmSession->read()fromonWritemitigated the bug! Should that be the case? Why would having 2read()calls on the session conflict each other? Is that an expected result or was I doing something wrong? On the whole, why do we need to saymSession->read()every time and can't we have a client that is constantly listening/reading?