Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

SECDEVTOOL-OMAPL138C6748: Send large packet using TCP with Network Developers Kit (NDK) And NDK Support Package (NSP)

$
0
0

Part Number:SECDEVTOOL-OMAPL138C6748

I am using the network package ndk_evm6748_elf_helloWorld, 

The version of NDK: 2.25.1.11 and NSP: 1.10.3.15

SYSBIOS 6.46.4.53.

I took the code of the example TCP echo server from the document SPRU524J–May 2001 p.104 and modified as following:

#include <netmain.h>
#include "helloWorld.h"

#include <ti/sysbios/knl/Task.h>
//
// dtask_tcp_hello() - UDP Echo Server Daemon Function
// (SOCK_DGRAM, port 7)
//
// Returns "1" if socket 's' is still open, and "0" if its been closed
//
int dtask_tcp_echo( SOCKET s, UINT32 unused )
{
   struct timeval to;
   int I;
   char *pBuf;
   int i,j;

   HANDLE hBuffer;
   (void)unused;
   // Configure our socket timeout to be 5 seconds
   to.tv_sec = NULL;//5;
   to.tv_usec = 0; 
   setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof(to) );
   setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to) );
   I = 1;
   setsockopt( s, IPPROTO_TCP, TCP_NOOPT, &I, 4 );

   for(;;)
   {
      I = (int)recvnc( s, (void **)&pBuf, 0, &hBuffer );
      // If we read data, echo it back
      if(I > 0)
      {
         j=0;
         for(i=0;i<200;i++)
         {
            if(send( s, stringData+j, 1000, 0) < 0)
            {
               break;
            }
            j=j+1000;
           recvncfree( hBuffer );
         }

      }
      // If the connection got an error or disconnect, close
      else
         break;
   }

   fdClose( s );
   // Return "0" since we closed the socket
   return(0);
}

=========================================================================================

stringData[] is a char array have a size of 20000. I am expecting those 200000 bytes char will be sent out. However, I only got about 100000 bytes. I tried to suspend running in debug mode. It looks like the program goes to the Idle_run() before the for loop is done. Tried to set break point at "break" right after send(), never reached.Can you give me some suggestions?

Thanks,
Andy

 


Viewing all articles
Browse latest Browse all 17527

Trending Articles