[ENet-discuss] ENet and multiple clients

GhostManZero ghostmanzero at lutherlink.de
Sat Oct 6 03:29:08 PDT 2007


Could it be because i give the server program quite a small ammount of  
time to do enet_host_service every time, in the server's main loop?

I'm doing my main loop calling a function that treats messages like so:

		while(1)
		{
			//Search for 25 ms
			int Status = enet_host_service (RealObject->host, &event, 25);
			if(Status < 0) //failure
			{
				break;
			}
			else if(Status == 0) //No event
			{
				break;
			};
			//New event
			switch(event.type)
                         //...

Maybe the total ammount of ms is either not much, or the whole  
while(1) idea isnt so good, considering how its receiving a lot of  
msgs and thus might keep itself in an infinite loop because of so.

I think it might be pretty obvious now, but i'd still like to know  
what do you guys think. Is it the while(1) loop or the ammount of ms,  
or both?

Quoting Kevin Gadd <kevin.gadd at gmail.com>:

> Make sure you're servicing/polling your hosts frequently. I've experienced
> issues when sending off too many packets at once (in the neighborhood of
> thousands of packets) without servicing/polling in the interim; I think
> because the amount of time it then takes to service and dispatch all the
> packets is long enough for the connections to time out.
>
> Is this the use case you're having a problem with? Or is it more of an issue
> that arises after the application has been running for a long time? If it
> occurs after the app's been running for a long time, I would tend to suspect
> a bug or memory leak or scaling issue in your software, not a bug in enet
> (though anything's possible). I assume you're running in debug mode and
> checking for access violations, etc.?
>
> On 10/5/07, Lee Salzman <lsalzman1 at cox.net> wrote:
>>
>> If by freeze you mean an actual lockup in the server, then it is most
>> likely something in your code. I've never observed any kind of hard
>> lockup in ENet in 6 years.
>>
>> Lee
>>
>> GhostManZero wrote:
>> > I've been having quite a bad problem with ENet, depending on the
>> > ammount of data i send to myself (summoning multiple client programs
>> > to connect to a server program and constantly sending messages to the
>> > server), after awhile my server program simple freezes and all clients
>> > may even get disconnection events (its not certain).
>> >
>> > I'd like to know what could cause such behaviour, besides my own
>> > programming. I'm using ENet 1.1 on a C++ program.
>> >
>>
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>



-- 
~Zero




More information about the ENet-discuss mailing list