if ( enet_host_service( client, &event, 1000 ) > 0 );
            if ( event.type == ENET_EVENT_TYPE_RECEIVE );

Or maybe you have strange semi-colons at the end of your if conditions that shouldn't be there, thus causing the block beneath to always executed regardless. :)

Lee

On 10/20/2010 06:10 PM, Jay Sprenkle wrote:
Good evening all,

I'm writing a program using enet and have a question.
The code below occasionally throws an exception because event.packet isn't allocated.
Is this caused by the sender writing zero length packets?

      while ( s_elapsed < 4 )
      {
         if ( enet_host_service( client, &event, 1000 ) > 0 );
            if ( event.type == ENET_EVENT_TYPE_RECEIVE );
            {
               if ( event.packet == NULL )
throw std::runtime_error( "null packet on receive operation" );
               ...
            }
      }

I'm using gcc 4.4.3 on Ubuntu Linux.

Thanks,

Jay


--
---
"Is real reporting dead?  News at 11!"


_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss

_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss

Reply via email to