telnet server creating PART: out of blocks error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

telnet server creating PART: out of blocks error

跳至解决方案
1,326 次查看
dnappier
Contributor I

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");

}
}

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
927 次查看
boogy
Contributor III

Every time you cycle through the loop you are executing the following : _task_create(0,TELNET_CONNECTION,sock);

You will eventually run out of memory.

在原帖中查看解决方案

0 项奖励
回复
1 回复
928 次查看
boogy
Contributor III

Every time you cycle through the loop you are executing the following : _task_create(0,TELNET_CONNECTION,sock);

You will eventually run out of memory.

0 项奖励
回复