SDL_Net: Multiserver exhausting networking re sources

Hi, everybody.

I built a server in SDL_Net. One server to ten clients.

This server runs on a WinXP machine nicely configured. I call this
machine “server machine”.

Everything seems ok, but two days after start, the server machine already has
no more networking resources. You can’t navigate, can’t run NETSTAT or even
IPCONFIG. The O.S. message is “There’s no sufficient resources”.

The RAM memory consume is OK. Only the networking is affected.

Any of you have already passed by this kind of trouble?

Any tip? Sugestions?

Port to linux?

miguel escribi?:> Hi, everybody.

I built a server in SDL_Net. One server to ten clients.

This server runs on a WinXP machine nicely configured. I call this
machine “server machine”.

Everything seems ok, but two days after start, the server machine already has
no more networking resources. You can’t navigate, can’t run NETSTAT or even
IPCONFIG. The O.S. message is “There’s no sufficient resources”.

The RAM memory consume is OK. Only the networking is affected.

Any of you have already passed by this kind of trouble?

Any tip? Sugestions?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://dsgp.blogspot.com | Linux, programaci?n, juegos
Have no place I can be since I found Serenity
But you can?t take the sky from me


LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto.
http://es.voice.yahoo.com

What?

2007/6/4, Roger D Vargas <luo_hei at yahoo.es>:>

Port to linux?

miguel escribi?:

Hi, everybody.

I built a server in SDL_Net. One server to ten clients.

This server runs on a WinXP machine nicely configured. I call this
machine “server machine”.

Everything seems ok, but two days after start, the server machine
already has
no more networking resources. You can’t navigate, can’t run NETSTAT or
even
IPCONFIG. The O.S. message is “There’s no sufficient resources”.

The RAM memory consume is OK. Only the networking is affected.

Any of you have already passed by this kind of trouble?

Any tip? Sugestions?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://dsgp.blogspot.com | Linux, programaci?n, juegos
Have no place I can be since I found Serenity
But you can’t take the sky from me


LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto.
http://es.voice.yahoo.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

That seems like a handle leak.

Are you processing your network conections properly?

miguel schrieb:> Hi, everybody.

I built a server in SDL_Net. One server to ten clients.

This server runs on a WinXP machine nicely configured. I call this
machine “server machine”.

Everything seems ok, but two days after start, the server machine already has
no more networking resources. You can’t navigate, can’t run NETSTAT or even
IPCONFIG. The O.S. message is “There’s no sufficient resources”.

The RAM memory consume is OK. Only the networking is affected.

Any of you have already passed by this kind of trouble?

Any tip? Sugestions?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

If his code has resource leaks, porting to another OS won’t help.

And besides, Windows can also be quite stable.

Miguel Pragier schrieb:> What?

2007/6/4, Roger D Vargas <luo_hei at yahoo.es <mailto:luo_hei at yahoo.es>>:

Port to linux?

miguel escribi?:
> Hi, everybody.
>
> I built a server in SDL_Net. One server to ten clients.
>
> This server runs on a WinXP machine nicely configured. I call this
> machine "server machine".
>
> Everything seems ok, but two days after start, the server
machine already has
> no more networking resources. You can't navigate, can't run
NETSTAT or even
> IPCONFIG. The O.S. message is "There's no sufficient resources".
>
> The RAM memory consume is OK. Only the networking is affected.
>
> Any of you have already passed by this kind of trouble?
>
> Any tip? Sugestions?
>
>
>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>

--
http://dsgp.blogspot.com | Linux, programaci?n, juegos
Have no place I can be since I found Serenity
But you can't take the sky from me


______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto.
http://es.voice.yahoo.com
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

That’s the question I was waiting for.

Look the routine wich turnOn the listeners:

IPaddress ip;

Servidor.SocketSet = SDLNet_AllocSocketSet(QTD_MAX_CLIENTES+2);

if( !Servidor.SocketSet ) exit(-1);

if(SDLNet_ResolveHost(&ip, NULL, Config.Porta_Arcano) == -1) exit(-1);

Servidor.sckArcano = SDLNet_TCP_Open(&ip);

if( !Servidor.sckArcano ) exit(-1);

SDLNet_TCP_AddSocket(Servidor.SocketSet, Servidor.sckArcano);

Now, the NewClientAdmission routine:

void SRV_TestarSockets()

{

int rArc;

int i = 0;

rArc = SDLNet_CheckSockets(Servidor.SocketSet, 10);

if( rArc == -1 )

{

LOG_FRegistrar(“SDLNet_CheckSockets: %s\n”, SDLNet_GetError());

return;

}

if( !rArc )

return;

if( SDLNet_SocketReady(Servidor.sckArcano) )

{

SRV_Registrar_Arcano();

Servidor.HouveAtividade = 1;

return;

}

for(i=0; i<Servidor.ClientesConectados; i++)

{

if( SDLNet_SocketReady(Clientes[i].sckArcano) )

{

char msg[STR_100];

char str[STR_100];

int r;

memset(msg, 0, STR_100);

memset(str, 0, STR_100);

r = SDLNet_TCP_Recv(Clientes[i].sckArcano, msg, STR_100);

if( r == -1 )

{

SRV_DesconectarArcano(i);

Servidor.HouveAtividade = 1;

continue;

}

if( r == 0 )

{

SRV_DesconectarArcano(i);

Servidor.HouveAtividade = 1;

continue;

}

SRV_ExtrairComando(msg, str);

if( strlen(str) > 0 )

{

Servidor.HouveAtividade = 1;

SRV_InterpretarComando( i, str );

}

}

}

for(i=0; i<Servidor.ClientesConectados; i++)

{

if( SDLNet_SocketReady(Clientes[i].sckAcumulado) )

{

char msg[STR_100];

char str[STR_100];

int r;

memset(msg, 0, STR_100);

memset(str, 0, STR_100);

r = SDLNet_TCP_Recv(Clientes[i].sckAcumulado, msg, STR_100);

if( ( r == -1 ) || ( r == 0 ) )

{

Clientes[i].sckAcumulado = NULL;

continue;

}

SRV_ExtrairComando(msg, str);

if( strlen(str) > 0 )

{

SRV_InterpretarComando( i, str );

Servidor.HouveAtividade = 1;

}

}

}

}

This is the routine that disconnetcs a client.

void SRV_DesconectarArcano( const int cliente )

{

SDLNet_TCP_DelSocket(Servidor.SocketSet, Clientes[cliente].sckArcano);

if( Clientes[cliente].sckArcano )

{

SDLNet_TCP_Close(Clientes[cliente].sckArcano);

Clientes[cliente].sckArcano = NULL;

}}

AM I IN TROUBLE?

:wink:

I’m not familiar with SDLNet, but your code seems to
be ok.

Try to monitor your process handle’s usage with the taskmanager.

Cheers,
Paulo

Miguel Pragier schrieb:> This is the routine that disconnetcs a client.

void

SRV_DesconectarArcano( const int cliente )

{

SDLNet_TCP_DelSocket(Servidor.SocketSet, Clientes[cliente].sckArcano);

if( Clientes[cliente].sckArcano )

{

SDLNet_TCP_Close(Clientes[cliente].sckArcano);

Clientes[cliente].sckArcano = NULL;

}}

AM I IN TROUBLE?

:wink:



SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Be warned that by default XP limits you to a maximum of 10 in bound
connections (see http://support.microsoft.com/kb/314882 ). This may not
necessarily be the problem you are seeing though.On Mon, 2007-06-04 at 17:42 +0000, miguel wrote:

Everything seems ok, but two days after start, the server machine already has
no more networking resources. You can’t navigate, can’t run NETSTAT or even
IPCONFIG. The O.S. message is “There’s no sufficient resources”.

The RAM memory consume is OK. Only the networking is affected.
Any tip? Sugestions?


Sitsofe | http://sucs.org/~sits/