Try printing the pointer values as you assign/new (on connect) and free/delete (on disconnect). Then print pointer where you access your local 'peer' pointers.<br>You'll probably find that you access a peer after it has been deleted or such, my guess.<br>
<br>Ruud<br><br><div class="gmail_quote">On Thu, Apr 28, 2011 at 4:44 AM, Jacob F. <span dir="ltr"><<a href="mailto:queatz@gmail.com">queatz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>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.</div><div>
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.</div>


<div><br></div><div>Does enet do anything at all with peer->data?</div><div><br></div><div>Here is the whole server/client code (wrapped in Python, but it segfaults when using C++ also.)</div><div>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.</div>


<div><br></div><div>Server:</div><div><div><font face="'courier new', monospace">from scge import *</font></div><div><font face="'courier new', monospace">from time import *</font></div>

<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">serv = server() #defaults to localhost:2000</font></div>

<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">while True:</font></div><div><font face="'courier new', monospace"><span style="white-space: pre-wrap;"> </span>e = serv.service()</font></div>


<div><font face="'courier new', monospace"><span style="white-space: pre-wrap;">  </span>if e.type() == 'disconnect':</font></div><div><font face="'courier new', monospace"><span style="white-space: pre-wrap;">                </span>print('Someone disconnected.')</font></div>


<div><font face="'courier new', monospace"><span style="white-space: pre-wrap;">  </span>elif e.type() == 'connect':</font></div><div><font face="'courier new', monospace"><span style="white-space: pre-wrap;">         </span>print('Someone connected.')</font></div>


<div><font face="'courier new', monospace"><span style="white-space: pre-wrap;">  </span>elif e.type() == 'receive':</font></div><div><font face="'courier new', monospace"><span style="white-space: pre-wrap;">         </span>print('received')</font></div>


</div><div><font face="'courier new', monospace"><span style="white-space: pre-wrap;">      </span></font></div>

<div><span style="font-family: 'courier new',monospace;"><span style="white-space: pre-wrap;">    </span>sleep(.2)</span></div>

<div><span style="font-family: 'courier new',monospace;"><br></span></div><div><font face="arial, helvetica, sans-serif">Client:</font></div><div><span style="white-space: pre-wrap;"></span><font face="'courier new', monospace"><span style="white-space: pre-wrap;">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)</span></font></div><div><font face="'courier new', monospace"><span style="white-space: pre-wrap;"><br></span></font><div class="gmail_quote"><div><div></div><div class="h5">On Wed, Apr 27, 2011 at 4:45 PM, Jay Sprenkle <span dir="ltr"><<a href="mailto:jsprenkle@gmail.com" target="_blank">jsprenkle@gmail.com</a>></span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">If enet returns an error you don't change e.evt.peer->data and you don't return an error code.<div>
The code that calls this method has no way to detect if this happens.</div>

<div>It will blindly use that value when it may not be correct.</div><div><div></div><div>
<div><br><br><div class="gmail_quote">On Wed, Apr 27, 2011 at 3:34 PM, Jacob F. <span dir="ltr"><<a href="mailto:queatz@gmail.com" target="_blank">queatz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



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?<div><br></div></blockquote></div>




</div>
</div></div><br></div></div><div class="im">_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br>