Hello again. Some trouble occurs, when i'm trying to recieve a response from the task, which is "hanging" on port.
Here's the code
hEcho = DaemonNew( SOCK_STREAMNC, 0, 7, dtask_tcp_echo,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
hEchoUdp = DaemonNew( SOCK_DGRAM, 0, 7, dtask_udp_echo,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
hData = DaemonNew( SOCK_STREAM, 0, 1000, dtask_tcp_datasrv,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
hNull = DaemonNew( SOCK_STREAMNC, 0, 1001, dtask_tcp_nullsrv,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
hOob = DaemonNew( SOCK_STREAMNC, 0, 999, dtask_tcp_oobsrv,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
hRetr = DaemonNew(SOCK_DGRAM, 0, 5555, dtask_udp_transmit,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
hTask1 = DaemonNew(SOCK_DGRAM, 0, 5600, dtask1,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
hTask2 = DaemonNew(SOCK_DGRAM, 0, 5601, dtask2,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
hTaskCalculation = DaemonNew(SOCK_DGRAM, 0, 5000, dtask_Calculation,
OS_TASKPRINORM, OS_TASKPRINORM, 0, 1); // <<<<<<this task
And the code of the task:
#include <ti/ndk/inc/netmain.h>
#include "ti/platform/platform.h"
int dtask_Calculation ( SOCKET s, UINT32 unused ) // 5000 port
{
struct sockaddr_in sin1;
struct timeval to;
int i,tmp;
char *pBuf;
HANDLE hBuffer;
int inval;
int outval;
char outbuf[64];
char *poutbuf;
printf("UDP packet received\n");
(void)unused;
// Configure our socket timeout to be 3 seconds
to.tv_sec = 3;
to.tv_usec = 0;
setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof( to ) );
setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof( to ) );
for(;;)
{
tmp = sizeof( sin1 );
i = (int)recvncfrom( s, (void **)&pBuf, 0, (PSA)&sin1, &tmp, &hBuffer );
printf(pBuf);
printf("\n");
poutbuf = outbuf;
inval = atoi(pBuf);
outval = inval*4;
ltoa(outval, poutbuf);
if( i >= 0 )
{
sendto(s, "Message from port 5000", 22, 0,(PSA)&sin1, sizeof(sin1) );
sendto(s, 0, 0, 0,(PSA)&sin1, sizeof(sin1) );
recvncfree( hBuffer );
}
else
break;
}
// Since the socket is still open, return "1"
// (we need to leave UDP sockets open)
return(1);
}
And when i'm trying to contact this function, the following appears:
[C66xx_0] ti.sysbios.knl.Task: line 334: E_stackOverflow: Task 0x80029f08 stack overflow.
[C66xx_0] xdc.runtime.Error.raise: terminating execution
I've greatly increased the HEAP memory, but this had no effect. Please, help me solve this problem.
The other functions are working correctly, problem appears only when i'm working with the Calculation task.