[ENet-discuss] Connectionless? Reconnect?

Darrell Bircsak dbircsak at gmail.com
Sat Jul 2 21:15:03 PDT 2005


I just noticed in Tutorial.html under Disconnecting you mention this
line of code:
    enet_peer_disconnect (peer);

And in the tutorial.txt that comes with ENet I see:
    enet_peer_disconnect (& client -> peers [0]);

So the only real reason I see to get an ENetPeer back from
enet_host_connect is so you can error check:

    /* Initiate the connection, allocating the two channels 0 and 1. */
    peer = enet_host_connect (client, & address, 2);    
    
    if (peer == NULL)
    {
       fprintf (stderr, 
                "No available peers for initiating an ENet connection.\n");
       exit (EXIT_FAILURE);
    }

Otherwise just use the peer structure stored within ENetHost
(client)!!  (You might as well return an int in enet_host_connect)

Anyways, thanks for the great library, Mr.Salzman!  It is allowing me
to create some cool stuff!

Darrell Bircsak



More information about the ENet-discuss mailing list