I am using the RL-TCPNET library and have some issues as follows: I am using a UDP Client on my target device and sending data to the computer. However when I send data say 10000 times over UDP using the udp_send function , the data is not transmitted to the other end. I am using a send_data function (as done in the LED_Client example project) and in that function I am using a for loop of 10,000 iterations to write some data into the 'sendbuf' (obtained using udp_get_buf function) and the calling the udp_send function in the same loop. But this does not work. However when I reduce the iterations (i.e. send lesser number of times say 100 times) the data is sent properly. So, is this an issue of the timer interval or is it anything else? The following is cut from my code :-
#define SENDLEN 1 #define COUNT 10000 . . . void send_data (int tt) { U8 *sendbuf; int j,k,val1; char buff[500]={0}; int len,i; /* UDP */ if (socket_udp != 0) { /* Start Connection */ sendbuf = udp_get_buf (SENDLEN); sendbuf[0] ='S' ; udp_send (socket_udp, Rem_IP, PORT_NUM, sendbuf, 1); //=============SDRAM READ========================================== for (k=0;k<COUNT;k++) { wr_ptr = (DWORD *)SDRAM_BASE + k; val1 = *wr_ptr; len = sprintf(buff,"%d",val1); for(j=0;j<len;j++) { sendbuf[j]=buff[j]; } udp_send (socket_udp, Rem_IP, PORT_NUM, sendbuf, len); } for(j=0;j<1;j++) { sendbuf[j]='A'; } udp_send (socket_udp, Rem_IP, PORT_NUM, sendbuf, 10); for (k=0;k<COUNT;k++) { wr_ptr = (DWORD *)SDRAM_BASE + k; val1 = *wr_ptr; len = sprintf(buff,"%d",val1); for(j=0;j<len;j++) { sendbuf[j]=buff[j]; } udp_send (socket_udp, Rem_IP, PORT_NUM, sendbuf, len); } } // if socket udp ends } // func ends /*--------------------------- main ------------------------------------------*/ int main (void) { /* Main Thread of the TcpNet */ U8 protocol; U8 *sendbuf; int tt=0; int i; init (); init_TcpNet (); protocol = PROTOCOL; switch (protocol) { case TCP: socket_tcp = tcp_get_socket (TCP_TYPE_CLIENT, 0, 10, tcp_callback); break; case UDP: socket_udp = udp_get_socket (0, UDP_OPT_SEND_CS | UDP_OPT_CHK_CS, udp_callback); if (socket_udp != 0) { udp_open (socket_udp, PORT_NUM); } break; } tt=0; qq=100; while (1) { timer_poll (); main_TcpNet (); if (tick == __TRUE) { sendbuf = udp_get_buf (SENDLEN); sendbuf[0]=tt; udp_send (socket_udp, Rem_IP, PORT_NUM, sendbuf, 1); if(tt < 11) { send_data(tt); tt++; } tick = __FALSE; } } //while1 ends } //main ends
In this program , I have to send 10,000 values read from the SDRAM 10 (ten) times (tt=11). With every iteration of the while(1) loop the latest value of variable tt is checked to be less than 11 and only when this is true send_data function is called in which every time 10,000 values from the SDRAM are fetched and sent over UDP.
PLEASE HELP!!!