TCP Client Issue in Setup #2134
-
I am trying to set up a TCP client through F', and I'm modeling it off of the setup for the TCP client setup for the default communication driver in-built. I am able to connect to the TCP server and receive data, but I'm getting a weird error when trying to send data. The following assertion is failing: Svc > StaticMemory > bufferDeallocate_handler FW_ASSERT((fwBuffer.getData() + fwBuffer.getSize()) <= (m_static_memory[portNum] + sizeof(m_static_memory[0])), fwBuffer.getSize(), sizeof(m_static_memory[0])); I can't really make heads or tails of it, but I think it has to do with memory runoff. As in, it's trying to deallocate memory that wasn't allocated in the first place, which is a bit confusing. Here is how I am trying to send data to the TCP driver I've made, named Fw::String testString("Hello");
Fw::Buffer sendBuffer;
sendBuffer.setData(reinterpret_cast<U8 *>(const_cast<char *>(testString.toChar())));
sendBuffer.setSize(testString.length());
Drv::SendStatus status = this->dataOut_out(0, sendBuffer);
if (status.e != Drv::SendStatus::SEND_OK)
{
Fw::Logger::logMsg("[BME680] Failed to send packet to TCP.\n");
}
else
{
Fw::Logger::logMsg("[BME680] One packet sent to TCP.\n");
this->dataInDeallocate_out(0, sendBuffer);
} Here's my py2c.allocate -> staticMemory.bufferAllocate[Ports_StaticMemory.py2c] // defined in the StaticMemory enum
py2c.$recv -> bme680.dataIn
bme680.dataOut -> py2c.send
bme680.dataInDeallocate -> staticMemory.bufferDeallocate[Ports_StaticMemory.py2c]
py2c.deallocate -> staticMemory.bufferDeallocate[Ports_StaticMemory.py2c] ...and my Topology.cpp file: try {
Os::TaskString name("Py2c");
Fw::String py2chost("127.0.0.1");
py2c.configure(py2chost.toChar(), 7860);
py2c.startSocketTask(name, true, COMM_PRIORITY, Default::STACK_SIZE);
logger.log("[INFO] Connected to Py2c TCP server on port 7860.\n");
} catch(...) {
logger.log("[ERROR] Failed to start py2c socket task\n");
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@mosa11aei |
Beta Was this translation helpful? Give feedback.
-
Funnily enough, this is a very similar issue to another issue that was just posted. In general, this problem is caused by passing a buffer to StaticMemory's bufferDeallocate port that didn't come from StaticMemory's bufferAllocate port. You can think of Buffers as being required to follow a loop, starting from StaticMemory (or my preferred alternative, BufferManager), going through various components, and ending up at StaticMemory/BufferManager again. I would take a look at the setup and my answer for #3079 . In general, the flow you want is:
|
Beta Was this translation helpful? Give feedback.
Funnily enough, this is a very similar issue to another issue that was just posted. In general, this problem is caused by passing a buffer to StaticMemory's bufferDeallocate port that didn't come from StaticMemory's bufferAllocate port. You can think of Buffers as being required to follow a loop, starting from StaticMemory (or my preferred alternative, BufferManager), going through various components, and ending up at StaticMemory/BufferManager again.
I would take a look at the setup and my answer for #3079 .
In general, the flow you want is: