<div dir="ltr">Well, it's virtually in the same thread and the order of invocation is:<div><br></div><div>enet_host_create()</div><div>enet_socket_connect()</div><div>enet_host_service()</div><div><br></div><div>which works fine when connection to another ENetHost instance, so I expect for it to work the same way when connecting to itself.</div>
<div>Or at least I'm curious about the reason for this.   <div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 7, 2013 at 4:49 PM, Shaun Reich <span dir="ltr"><<a href="mailto:sreich@kde.org" target="_blank">sreich@kde.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">I'm guessing that you're doing it all on the same thread. My game uses enet also for singleplayer and just connects to localhost. So it uses 2 threads. It's not required of course, it just means you have to be aware of which calls block and to call them at the right times ;) </p>


<p dir="ltr">Sent from an Android phone. </p>
<div class="gmail_quote">On Nov 7, 2013 5:33 AM,  <<a href="mailto:enet-discuss-request@cubik.org" target="_blank">enet-discuss-request@cubik.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Send ENet-discuss mailing list submissions to<br>
        <a href="mailto:enet-discuss@cubik.org" target="_blank">enet-discuss@cubik.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:enet-discuss-request@cubik.org" target="_blank">enet-discuss-request@cubik.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:enet-discuss-owner@cubik.org" target="_blank">enet-discuss-owner@cubik.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of ENet-discuss digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re:  Connecting to self (Payton Turnage)<br>
   2. Re:  Connecting to self (Ruud van Gaal)<br>
   3. Re:  Connecting to self (Krasimir Marinov)<br>
   4. Re:  Connecting to self (Andrew Fenn)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 6 Nov 2013 16:27:03 -0500<br>
From: Payton Turnage <<a href="mailto:paytonturnage@gmail.com" target="_blank">paytonturnage@gmail.com</a>><br>
To: Discussion of the ENet library <<a href="mailto:enet-discuss@cubik.org" target="_blank">enet-discuss@cubik.org</a>><br>
Subject: Re: [ENet-discuss] Connecting to self<br>
Message-ID:<br>
        <CAF9Sf24JhcW9ka9BHVObj36oaX9Nna=XXTvSpbH=<a href="mailto:JVz3W1M%2BPQ@mail.gmail.com" target="_blank">JVz3W1M+PQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="windows-1252"<br>
<br>
Can you provide relevant code? How are you trying to connect to yourself?<br>
<br>
<br>
On Wed, Nov 6, 2013 at 8:37 AM, Krasimir Marinov <<a href="mailto:krasi@jklsemi.com" target="_blank">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.*Adam D. Moss* adam at <a href="http://gimp.org" target="_blank">gimp.org</a> <enet-discuss%<a href="http://40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=" target="_blank">40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=</a>><br>


> *Wed Dec 1 08:44:30 PST 2004*<br>
><br>
><br>
>    - Next message: [ENet-discuss] Connecting to self.<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html</a>><br>


>    - *Messages sorted by:* [ date ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311</a>><br>


>     [ thread ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311</a>><br>
>     [ subject ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311</a>><br>
>     [ author ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311</a>><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" 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>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20131106/b0e680b4/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20131106/b0e680b4/attachment-0001.html</a>><br>


<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 7 Nov 2013 11:00:44 +0100<br>
From: Ruud van Gaal <<a href="mailto:ruud@racer.nl" target="_blank">ruud@racer.nl</a>><br>
To: Discussion of the ENet library <<a href="mailto:enet-discuss@cubik.org" target="_blank">enet-discuss@cubik.org</a>><br>
Subject: Re: [ENet-discuss] Connecting to self<br>
Message-ID:<br>
        <CADULfbPHZZvt=+<a href="mailto:e84qj%2BT62cJrO%2BqGyLjM1h55_DSAsopSSMmQ@mail.gmail.com" target="_blank">e84qj+T62cJrO+qGyLjM1h55_DSAsopSSMmQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="windows-1252"<br>
<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<br>
its own server).<br>
Ruud<br>
<br>
<br>
On Wed, Nov 6, 2013 at 2:37 PM, Krasimir Marinov <<a href="mailto:krasi@jklsemi.com" target="_blank">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.*Adam D. Moss* adam at <a href="http://gimp.org" target="_blank">gimp.org</a> <enet-discuss%<a href="http://40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=" target="_blank">40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=</a>><br>


> *Wed Dec 1 08:44:30 PST 2004*<br>
><br>
><br>
>    - Next message: [ENet-discuss] Connecting to self.<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html</a>><br>


>    - *Messages sorted by:* [ date ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311</a>><br>


>     [ thread ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311</a>><br>
>     [ subject ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311</a>><br>
>     [ author ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311</a>><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" 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>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20131107/7849155f/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20131107/7849155f/attachment-0001.html</a>><br>


<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 7 Nov 2013 12:14:39 +0200<br>
From: Krasimir Marinov <<a href="mailto:krasi@jklsemi.com" target="_blank">krasi@jklsemi.com</a>><br>
To: Discussion of the ENet library <<a href="mailto:enet-discuss@cubik.org" target="_blank">enet-discuss@cubik.org</a>><br>
Subject: Re: [ENet-discuss] Connecting to self<br>
Message-ID:<br>
        <CA+M1DxdvZNTxXv-Z=<a href="mailto:mgj8hOmLSambkaeSXX-MYMq2QJydt0QWg@mail.gmail.com" target="_blank">mgj8hOmLSambkaeSXX-MYMq2QJydt0QWg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="windows-1252"<br>
<br>
Well, what you describe seems to me that you connect peers from different<br>
ENetHost(s).<br>
<br>
What I've tested is merely the same (pseudocode):<br>
<br>
    ENetAddress address;<br>
    a.host = <localhost><br>
    a.port = <port><br>
<br>
    EnetHost *host = enet_host_create(&address, .....);<br>
    enet_host_connect(host, &address, ...);<br>
<br>
Notice that the enet_host_connect() connects to the address which ENetHost<br>
was initialised with.<br>
<br>
Regards,<br>
Krasimir<br>
<br>
On Thu, Nov 7, 2013 at 12:00 PM, Ruud van Gaal <<a href="mailto:ruud@racer.nl" target="_blank">ruud@racer.nl</a>> wrote:<br>
<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<br>
> its own server).<br>
> Ruud<br>
><br>
><br>
> On Wed, Nov 6, 2013 at 2:37 PM, Krasimir Marinov <<a href="mailto:krasi@jklsemi.com" target="_blank">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<br>
>> to, 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.*Adam D. Moss* adam at <a href="http://gimp.org" target="_blank">gimp.org</a> <enet-discuss%<a href="http://40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=" target="_blank">40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=</a>><br>


>> *Wed Dec 1 08:44:30 PST 2004*<br>
>><br>
>><br>
>>    - Next message: [ENet-discuss] Connecting to self.<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html</a>><br>


>>    - *Messages sorted by:* [ date ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311</a>><br>


>>     [ thread ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311</a>><br>
>>     [ subject ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311</a>><br>
>>     [ author ]<<a href="http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311</a>><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" 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>
>><br>
><br>
> _______________________________________________<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>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20131107/093b9fc8/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20131107/093b9fc8/attachment-0001.html</a>><br>


<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Thu, 7 Nov 2013 17:08:56 +0700<br>
From: Andrew Fenn <<a href="mailto:andrewfenn@gmail.com" target="_blank">andrewfenn@gmail.com</a>><br>
To: Discussion of the ENet library <<a href="mailto:enet-discuss@cubik.org" target="_blank">enet-discuss@cubik.org</a>><br>
Subject: Re: [ENet-discuss] Connecting to self<br>
Message-ID:<br>
        <<a href="mailto:CAKDYWvSdrpd9%2BAEN4NpirMr170ixh23vLMNa2Sh-S0TrhPvmwg@mail.gmail.com" target="_blank">CAKDYWvSdrpd9+AEN4NpirMr170ixh23vLMNa2Sh-S0TrhPvmwg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
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>
<br>
On Thu, Nov 7, 2013 at 5:00 PM, Ruud van Gaal <<a href="mailto:ruud@racer.nl" target="_blank">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" target="_blank">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" 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>
><br>
><br>
> _______________________________________________<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>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<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>
<br>
End of ENet-discuss Digest, Vol 125, Issue 3<br>
********************************************<br>
</blockquote></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></div></div></div>