[ENet-discuss] ENetPeer->data and enet_host_service

Jacob F. queatz at gmail.com
Wed Apr 27 19:44:22 PDT 2011


How it is now if it's an error event.type() will return 'none' however I
have tested it and no errors are being created (as far as I can tell.)  I
updated the code a little, still nothing good.
I did find one more thing though.  The client is printing that it connected
1 client-service before the server prints that a client connected, and only
on the next client-service it connects on the server, and then the next
server-service segfaults.

Does enet do anything at all with peer->data?

Here is the whole server/client code (wrapped in Python, but it segfaults
when using C++ also.)
I know it would be easier to debug if I remade everything step by step from
scratch, though I'm afraid I would arrive at the same place without a
visible explanation.  I will do that if we cannot figure this out.

Server:
from scge import *
from time import *

serv = server() #defaults to localhost:2000

while True:
e = serv.service()
 if e.type() == 'disconnect':
print('Someone disconnected.')
 elif e.type() == 'connect':
print('Someone connected.')
 elif e.type() == 'receive':
print('received')
  sleep(.2)

Client:
from scge import * from time import * cli = client() cli.connect()
window(160, 120) while window_opened(): e = cli.service() if e.type() ==
'connect': print('Connected.') swap() sleep(.01)

On Wed, Apr 27, 2011 at 4:45 PM, Jay Sprenkle <jsprenkle at gmail.com> wrote:

> If enet returns an error you don't change e.evt.peer->data and you don't
> return an error code.
> The code that calls this method has no way to detect if this happens.
> It will blindly use that value when it may not be correct.
>
>
> On Wed, Apr 27, 2011 at 3:34 PM, Jacob F. <queatz at gmail.com> wrote:
>
>> Both the server and client are created without an error, and I can receive
>> the data placed into e.evt.peer->data after I set it.  Are there any
>> specific errors that I should check for?
>>
>>
> _______________________________________________
> 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/20110427/6ca62e40/attachment-0001.html>


More information about the ENet-discuss mailing list