AnsweredAssumed Answered

telnet server creating PART: out of blocks error

Question asked by Doug Nappier on Jan 14, 2012
Latest reply on Jan 17, 2012 by RICK BOURGEOIS

I have made a simple telnet server that accepts a connection and sends the stream socket to a new thread. It works great with one connection but the second will accept the connection and then die.

 

When I pause the program and look at the server task summary it show PART: Out of Blocks error. Does anyone know what this and how do I fix it? I am not doing any partitioning myself.

 

The code is below

 

/*
* telnet_server.c
*
* Created on: Jan 11, 2012
* Author: Doug Nappier
*/

#include "telnet_server.h"

void telnet_server(uint_8 parameters)
{
uint_32 sock,listensock;
sockaddr_in blue_box_addr;
uint_32 error = 256;
char str[] = "\n Connected to Blue Box \n";

listensock = socket(PF_INET, SOCK_STREAM, 0);
setsockopt(listensock, SOL_TCP, OPT_TBSIZE, &error, sizeof(error));
setsockopt(listensock, SOL_TCP, OPT_RBSIZE, &error, sizeof(error));
error = 1000;

setsockopt(listensock, SOL_TCP, OPT_TIMEWAIT_TIMEOUT, &error, sizeof(error));

blue_box_addr.sin_family = AF_INET;
blue_box_addr.sin_port = IPPORT_TELNET;
blue_box_addr.sin_addr.s_addr = INADDR_ANY;
tel = 0;
error = bind(listensock, &blue_box_addr, sizeof(blue_box_addr));

error = listen(listensock, 0);
while(TRUE)
{
sock = accept(listensock, NULL, NULL);
if(sock != RTCS_SOCKET_ERROR){
++telnet_count;
printf("\n\rConnection made %d\n\r",telnet_count);
send(sock,str,sizeof(str)-1,0);
_task_create(0,TELNET_CONNECTION,sock);
}
else printf("\r\nsocket error\r\n");

}
}

Outcomes