Hi,
I'm trying to make a very simpel program with the MCB52233 to act as a TCP socket listener and display the data coming in on the UART and then close the connection afterwards.
I've downloaded the latest version of the InterNiche TCP/IP Lite stack (Version 3.0) and the CW (Version 7.1).
When I do this simple task:
void emg_tcp_rx( void )
{
static int length, i;
unsigned long rate;
// PARAM1: M_SOCK socket,
// PARAM2: char * buffer
// PARAM3: unsigned length
//
// RETURNS: number of bytes actually read, or -1 if error.
// int m_recv(M_SOCK so, char * buf, unsigned buflen)
// printf ("emg_tcp_rx Enter\n");
length = m_recv( emg_tcp_communication_socket, (char *)buffer, RX_BUFFER_SIZE );
if( length > 0)
{
buffer[length] = '\0';
if(buffer[0]== 0x0d)
printf("\n");
else
{
printf("%s",buffer);
if(buffer[length-1]==0x0d)
{
printf("\n");
}
}
// m_send(emg_tcp_communication_socket,(char *)buffer,length); //FSL echo back data
}
}
...my text comes out on the UART the first 25 times (using a .NET program to act as client to create a TCP socket and send "Hello World" and then close the connection) - after this I get this error:
"calloc1 failed: size: 124, failures: 1"
.....this will then make the program unable to communicate anymore!
What I'm I doing wrong here?
Best Regards
Brian A.