<div dir="ltr">The code that you shared connects peers from 2 different ENetHosts.<div><br></div><div>The pseudocode that I showed</div><div><div style="font-family:arial,sans-serif;font-size:13px">    </div><div style="font-family:arial,sans-serif;font-size:13px">
    ENetAddress address;</div><div style="font-family:arial,sans-serif;font-size:13px">    a.host = <localhost></div><div style="font-family:arial,sans-serif;font-size:13px">    a.port = <port></div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">    EnetHost *host = enet_host_create(&address, .....);</div><div style="font-family:arial,sans-serif;font-size:13px">    enet_host_connect(host, &address, ...);</div>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">tries to connect the host to itself. Notice that there is only one address and one host!</div>
<div style="font-family:arial,sans-serif;font-size:13px"> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 7, 2013 at 12:08 PM, Andrew Fenn <span dir="ltr"><<a href="mailto:andrewfenn@gmail.com" target="_blank">andrewfenn@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don't have any problems with a running a client / server on the same<br>
machine. My code is available here, it's unfinished overall however<br>
the enet connection stuff has worked without problems for a long time.<br>
<br>
<a href="https://github.com/andrewfenn/Hardwar" target="_blank">https://github.com/andrewfenn/Hardwar</a><br>
Server: <a href="https://github.com/andrewfenn/Hardwar/blob/master/code/server/src/Server.cpp" target="_blank">https://github.com/andrewfenn/Hardwar/blob/master/code/server/src/Server.cpp</a><br>
Client: <a href="https://github.com/andrewfenn/Hardwar/blob/master/code/client/tasks/src/NetworkTask.cpp" target="_blank">https://github.com/andrewfenn/Hardwar/blob/master/code/client/tasks/src/NetworkTask.cpp</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Nov 7, 2013 at 5:00 PM, Ruud van Gaal <<a href="mailto:ruud@racer.nl">ruud@racer.nl</a>> wrote:<br>
> All I can say that in principle this works; I use this every day (a single<br>
> exe running both and a server and a client, where the client connects to its<br>
> own server).<br>
> Ruud<br>
><br>
><br>
> On Wed, Nov 6, 2013 at 2:37 PM, Krasimir Marinov <<a href="mailto:krasi@jklsemi.com">krasi@jklsemi.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I’ve been trying to connect to the host:port that my ENetHost is bound to,<br>
>> i.e. connect and send to myself.<br>
>> Unfortunately this almost immediately results in event DISCONNECT.<br>
>><br>
>> Looking at the archives I found the same problem raised 9 years ago (see<br>
>> below).<br>
>><br>
>> Any reason for this behaviour?<br>
>><br>
>> Regards,<br>
>> Krasimir<br>
>><br>
>> [ENet-discuss] Connecting to self.<br>
>><br>
>> Adam D. Moss adam at <a href="http://gimp.org" target="_blank">gimp.org</a><br>
>> Wed Dec 1 08:44:30 PST 2004<br>
>><br>
>> Next message: [ENet-discuss] Connecting to self.<br>
>> Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]<br>
>><br>
>> ________________________________<br>
>><br>
>> Hi!<br>
>> I have a funny problem.  My app listens on a port and then attempts<br>
>> to connect to itself (for testing purposes, for now).  But this<br>
>> merely eventually causes a DISCONNECT (presumably time-out) event,<br>
>> with no CONNECT.<br>
>><br>
>> However, if I launch a second process and do the connect from<br>
>> there, the connection is fine.<br>
>><br>
>> Am I being stupid for attempting to have a process be a client<br>
>> of its own server, or is there some unexpected strangeness which<br>
>> prevents an ENet server from being its own client?<br>
>><br>
>> Thanks,<br>
>> --Adam<br>
>><br>
>><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>
><br>
><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>
_______________________________________________<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>
</div></div></blockquote></div><br></div>