Azure-RTOS/Netx, how to transmit tcp data?

cancel
Showing results for 
Search instead for 
Did you mean: 

Azure-RTOS/Netx, how to transmit tcp data?

244 Views
arimendes
Contributor III

Hi,

I am trying to make a TCP-Server application for the MIMXRT1020-EVK card using Netx.

My application needs to receive a command via TCP and transmit a 6144-byte buffer in response.

Using the function below, the application works correctly if len is up to 4096 bytes, otherwise send_tcp fails. 

What am I doing wrong in the code below? Is it necessary to segment the buffer into smaller packets and wait for each one to be transmitted before transmitting the next one?
Does anyone know any higher level way to transmit data via TCP on NetX?

void TCP_Send(void *buf, uint32_t len)

{

 UINT ret;

 NX_PACKET *send_packet;

 

nx_packet_allocate(&AppPool,&send_packet,NX_TCP_PACKET,NX_WAIT_FOREVER);  

nx_packet_data_append(send_packet,buf,len,&AppPool,NX_WAIT_FOREVER);

ret = nx_tcp_socket_send(&TCPSocket, send_packet, NX_WAIT_FOREVER);

if(ret) nx_packet_release(send_packet);

}  

 

0 Kudos
1 Reply

237 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
According to your statement,
nx_tcp_socket_send(&TCPSocket, send_packet, NX_WAIT_FOREVER) will fail to transfer the data whose size exceeds the 4096 bytes, is my understanding right?
If yes, can you tell the value of the return value: ret, as it can help us to figure the failure out.
And you can find the introduction of the nx_tcp_socket_send function in the below link.
https://docs.microsoft.com/en-us/azure/rtos/netx/chapter4
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos