[ENet-discuss] Newby cannot get to step one...

Jonas Beck ninnghazad at dnophos.de
Wed Dec 13 18:22:29 UTC 2017


https://github.com/stuntrally/stuntrally/blob/master/source/network/enet-wrapper.hpp

helped me to understand how to use enet with c++. 


On December 13, 2017 10:17:17 AM GMT+01:00, Ian Badcoe <ian_badcoe at yahoo.co.uk> wrote:
>Hi Jonas,
>Do you have a link to ENET_wrapper.hpp?  Searching I can find
>variations on that name, but no an exact match.
>I can also find projects that describe themselves as enet wrappers, but
>which don't contain a file of that name (and I don't want to set off
>with a random project if there is some recommended source that would be
>better for me...)
>Thanks again,
>Ian
>
> 
>
>On Tuesday, 12 December 2017, 18:01:51 GMT, Jonas Beck
><ninnghazad at dnophos.de> wrote:  
> 
> 1,2,3: yes
>try simple enet-only example code same machine.
>bonus: search for ENET_wrapper.hpp for nice c++ example.
>
>On December 12, 2017 5:08:35 PM GMT+01:00, Ian Badcoe
><ian_badcoe at yahoo.co.uk> wrote:
>Hi,
>I'm trying to create a prototype game using enet for networked play.
>I am creating the host and client very similarly to what is shown in
>the tutorial, but I cannot get the client to connect to the server.  So
>far, this is all on the same machine...  A client should be able to
>find a server on the same machine, shouldn't it?
>I have tried adjusting the port and address settings in many different
>ways in an attempt to make it work but everything fails the same way,
>e.g. the "enet_host_service" call that I make after "enet_host_connet"
>times out without generating any event.
>My code is quite large (because I have integrated enet into the
>existing non-networked codebase) but what is done with enet is pretty
>simple (and even simpler during this initial phase...)
>The host was created like this:
>    ENetAddress address;
>
>    address.host = ENET_HOST_ANY;
>    address.port = 1234;
>    _data->_enet_host = enet_host_create(
>        &address,
>        32,
>        2,
>        0, 0);
>and then goes into a loop which calls enet_host_service continually:
>        int ret = enet_host_service(_data->_enet_host, &event, 5);
>
>-----
>
>The client was created like this:
>    _data->_enet_host = enet_host_create(
>        NULL,
>        1,
>        2,
>        0, 0);
>
>    if (!_data->_enet_host)
>    {
>        ...
>    }
>
>    int ret;
>    ENetAddress address;
>    address.host = ENET_HOST_BROADCAST;
>    address.port = _data->_port;
>
>    _data->_enet_peer = enet_host_connect(_data->_enet_host, &address,
>1, 0);
>
>    if (_data->_enet_peer == NULL)
>    {
>        ...
>    }
>
>    ENetEvent event;
>
>    ret = enet_host_service(_data->_enet_host, &event, 5000);
>
>    if (ret > 0 && event.type == ENET_EVENT_TYPE_CONNECT)    {       
>... <- we never get here and "ret" is always zero
>    }
>
>-----
>I have tried a lot of possibilities for the address and port settings,
>addresses including:
>127.0.0.1ENET_HOST_ANY  (host)
>ENET_HOST_BROADCAST  (client)
>local ip
>
>and various ports such as 55555 or 5432
>but nothing seems to work.  I am compiling for x64 on windows using
>VC2017.  Enet is running in its own thread, and I have been careful
>with a critical_section for the parts that need it, but the program is
>not getting far enough to reach any thread<->thread issues yet...  
>My problem is I don't know where the problem might lie:
>1) can Enet work on a single machine?2) can ENET_HOST_BROADCAST work on
>a single machine?3) can it be network settings / firewall (I doubt this
>since in the past I have done a lot of general client server work from
>VMs hosted on this same machine without any difficulty...)
>I basically need some hint on where to look for the problem...  Does
>Enet have some sort of verbose mode that will log problems to the debug
>stream?
>Thanks for any help, I did try looking in the mail-list archives but my
>problem is not really knowing what to search for...
>Later I will try again at home, which should eliminate
>network/firewalls as a possibility...
>Thanks again,
>Ian
>
>
>
>
>_______________________________________________
>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/20171213/738ecc8f/attachment-0001.html>


More information about the ENet-discuss mailing list