[ENet-discuss] event.peer == null
Lee Salzman
lsalzman1 at cox.net
Wed Oct 20 18:52:35 PDT 2010
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
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20101020/81b3afee/attachment.html>
More information about the ENet-discuss
mailing list