Closed chrishoen closed 5 months ago
Your code looks good. What problem do you encounter?
Hi,
I think code is not 100% correct, because it does not check buffer mRxSocketBuffer[] for overflow. I think it should be called _nx_packet_lengthget() first to allow overflow check.
Jan
Thanks guys.
Chris
Thanks
I'm having problems with a thread that receives large tcp messages (100 KB). The thread uses a tcp socket receive notification callback that reads packets into a buffer. Because the documentation on how to do this isn't very good, I was wondering if you could verify that the following looks okay:
void TcpServerThread::onRxNotify1(NX_TCP_SOCKET aSocket) { UINT tRet = 0; NX_PACKET tPacket = 0; ULONG tRxSize = 0;
// Loop to read tcp packet chains into the receive socket buffer until // the receive queue is empty. while (1) { // Nonblocking receive a packet chain. tRet = nx_tcp_socket_receive(&mSocket, &tPacket, NX_NO_WAIT);
}
// Done extracting into the buffer. trc_write("recv1 done %d", mRxTotalSize); }
Thanks Chris