[ENet-discuss] ENet-discuss Digest, Vol 125, Issue 3

Krasimir Marinov krasi at jklsemi.com
Thu Nov 7 09:01:58 PST 2013


Well, it's virtually in the same thread and the order of invocation is:

enet_host_create()
enet_socket_connect()
enet_host_service()

which works fine when connection to another ENetHost instance, so I expect
for it to work the same way when connecting to itself.
Or at least I'm curious about the reason for this.


On Thu, Nov 7, 2013 at 4:49 PM, Shaun Reich <sreich at kde.org> wrote:

> 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 ;)
>
> Sent from an Android phone.
> On Nov 7, 2013 5:33 AM, <enet-discuss-request at cubik.org> wrote:
>
>> Send ENet-discuss mailing list submissions to
>>         enet-discuss at cubik.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         http://lists.cubik.org/mailman/listinfo/enet-discuss
>> or, via email, send a message with subject or body 'help' to
>>         enet-discuss-request at cubik.org
>>
>> You can reach the person managing the list at
>>         enet-discuss-owner at cubik.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of ENet-discuss digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Re:  Connecting to self (Payton Turnage)
>>    2. Re:  Connecting to self (Ruud van Gaal)
>>    3. Re:  Connecting to self (Krasimir Marinov)
>>    4. Re:  Connecting to self (Andrew Fenn)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Wed, 6 Nov 2013 16:27:03 -0500
>> From: Payton Turnage <paytonturnage at gmail.com>
>> To: Discussion of the ENet library <enet-discuss at cubik.org>
>> Subject: Re: [ENet-discuss] Connecting to self
>> Message-ID:
>>         <CAF9Sf24JhcW9ka9BHVObj36oaX9Nna=XXTvSpbH=
>> JVz3W1M+PQ at mail.gmail.com>
>> Content-Type: text/plain; charset="windows-1252"
>>
>> Can you provide relevant code? How are you trying to connect to yourself?
>>
>>
>> On Wed, Nov 6, 2013 at 8:37 AM, Krasimir Marinov <krasi at jklsemi.com>
>> wrote:
>>
>> > Hi,
>> >
>> > I?ve been trying to connect to the host:port that my ENetHost is bound
>> to,
>> > i.e. connect and send to myself.
>> > Unfortunately this almost immediately results in event DISCONNECT.
>> >
>> > Looking at the archives I found the same problem raised 9 years ago (see
>> > below).
>> >
>> > Any reason for this behaviour?
>> >
>> > Regards,
>> > Krasimir
>> >
>> > [ENet-discuss] Connecting to self.*Adam D. Moss* adam at gimp.org<enet-discuss%
>> 40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=
>> >
>> > *Wed Dec 1 08:44:30 PST 2004*
>> >
>> >
>> >    - Next message: [ENet-discuss] Connecting to self.<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html>
>> >    - *Messages sorted by:* [ date ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311
>> >
>> >     [ thread ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311
>> >
>> >     [ subject ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311
>> >
>> >     [ author ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311
>> >
>> >
>> > ------------------------------
>> >
>> > Hi!
>> > I have a funny problem.  My app listens on a port and then attempts
>> > to connect to itself (for testing purposes, for now).  But this
>> > merely eventually causes a DISCONNECT (presumably time-out) event,
>> > with no CONNECT.
>> >
>> > However, if I launch a second process and do the connect from
>> > there, the connection is fine.
>> >
>> > Am I being stupid for attempting to have a process be a client
>> > of its own server, or is there some unexpected strangeness which
>> > prevents an ENet server from being its own client?
>> >
>> > Thanks,
>> > --Adam
>> >
>> >
>> > _______________________________________________
>> > 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/20131106/b0e680b4/attachment-0001.html
>> >
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Thu, 7 Nov 2013 11:00:44 +0100
>> From: Ruud van Gaal <ruud at racer.nl>
>> To: Discussion of the ENet library <enet-discuss at cubik.org>
>> Subject: Re: [ENet-discuss] Connecting to self
>> Message-ID:
>>         <CADULfbPHZZvt=+
>> e84qj+T62cJrO+qGyLjM1h55_DSAsopSSMmQ at mail.gmail.com>
>> Content-Type: text/plain; charset="windows-1252"
>>
>> All I can say that in principle this works; I use this every day (a single
>> exe running both and a server and a client, where the client connects to
>> its own server).
>> Ruud
>>
>>
>> On Wed, Nov 6, 2013 at 2:37 PM, Krasimir Marinov <krasi at jklsemi.com>
>> wrote:
>>
>> > Hi,
>> >
>> > I?ve been trying to connect to the host:port that my ENetHost is bound
>> to,
>> > i.e. connect and send to myself.
>> > Unfortunately this almost immediately results in event DISCONNECT.
>> >
>> > Looking at the archives I found the same problem raised 9 years ago (see
>> > below).
>> >
>> > Any reason for this behaviour?
>> >
>> > Regards,
>> > Krasimir
>> >
>> > [ENet-discuss] Connecting to self.*Adam D. Moss* adam at gimp.org<enet-discuss%
>> 40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=
>> >
>> > *Wed Dec 1 08:44:30 PST 2004*
>> >
>> >
>> >    - Next message: [ENet-discuss] Connecting to self.<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html>
>> >    - *Messages sorted by:* [ date ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311
>> >
>> >     [ thread ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311
>> >
>> >     [ subject ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311
>> >
>> >     [ author ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311
>> >
>> >
>> > ------------------------------
>> >
>> > Hi!
>> > I have a funny problem.  My app listens on a port and then attempts
>> > to connect to itself (for testing purposes, for now).  But this
>> > merely eventually causes a DISCONNECT (presumably time-out) event,
>> > with no CONNECT.
>> >
>> > However, if I launch a second process and do the connect from
>> > there, the connection is fine.
>> >
>> > Am I being stupid for attempting to have a process be a client
>> > of its own server, or is there some unexpected strangeness which
>> > prevents an ENet server from being its own client?
>> >
>> > Thanks,
>> > --Adam
>> >
>> >
>> > _______________________________________________
>> > 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/20131107/7849155f/attachment-0001.html
>> >
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Thu, 7 Nov 2013 12:14:39 +0200
>> From: Krasimir Marinov <krasi at jklsemi.com>
>> To: Discussion of the ENet library <enet-discuss at cubik.org>
>> Subject: Re: [ENet-discuss] Connecting to self
>> Message-ID:
>>         <CA+M1DxdvZNTxXv-Z=
>> mgj8hOmLSambkaeSXX-MYMq2QJydt0QWg at mail.gmail.com>
>> Content-Type: text/plain; charset="windows-1252"
>>
>> Well, what you describe seems to me that you connect peers from different
>> ENetHost(s).
>>
>> What I've tested is merely the same (pseudocode):
>>
>>     ENetAddress address;
>>     a.host = <localhost>
>>     a.port = <port>
>>
>>     EnetHost *host = enet_host_create(&address, .....);
>>     enet_host_connect(host, &address, ...);
>>
>> Notice that the enet_host_connect() connects to the address which ENetHost
>> was initialised with.
>>
>> Regards,
>> Krasimir
>>
>> On Thu, Nov 7, 2013 at 12:00 PM, Ruud van Gaal <ruud at racer.nl> wrote:
>>
>> > All I can say that in principle this works; I use this every day (a
>> single
>> > exe running both and a server and a client, where the client connects to
>> > its own server).
>> > Ruud
>> >
>> >
>> > On Wed, Nov 6, 2013 at 2:37 PM, Krasimir Marinov <krasi at jklsemi.com
>> >wrote:
>> >
>> >> Hi,
>> >>
>> >> I?ve been trying to connect to the host:port that my ENetHost is bound
>> >> to, i.e. connect and send to myself.
>> >> Unfortunately this almost immediately results in event DISCONNECT.
>> >>
>> >> Looking at the archives I found the same problem raised 9 years ago
>> (see
>> >> below).
>> >>
>> >> Any reason for this behaviour?
>> >>
>> >> Regards,
>> >> Krasimir
>> >>
>> >> [ENet-discuss] Connecting to self.*Adam D. Moss* adam at gimp.org<enet-discuss%
>> 40cubik.org?Subject=%5BENet-discuss%5D%20Connecting%20to%20self.&In-Reply-To=
>> >
>> >> *Wed Dec 1 08:44:30 PST 2004*
>> >>
>> >>
>> >>    - Next message: [ENet-discuss] Connecting to self.<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/000312.html>
>> >>    - *Messages sorted by:* [ date ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/date.html#311
>> >
>> >>     [ thread ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/thread.html#311
>> >
>> >>     [ subject ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/subject.html#311
>> >
>> >>     [ author ]<
>> http://lists.cubik.org/pipermail/enet-discuss/2004-December/author.html#311
>> >
>> >>
>> >> ------------------------------
>> >>
>> >> Hi!
>> >> I have a funny problem.  My app listens on a port and then attempts
>> >> to connect to itself (for testing purposes, for now).  But this
>> >> merely eventually causes a DISCONNECT (presumably time-out) event,
>> >> with no CONNECT.
>> >>
>> >> However, if I launch a second process and do the connect from
>> >> there, the connection is fine.
>> >>
>> >> Am I being stupid for attempting to have a process be a client
>> >> of its own server, or is there some unexpected strangeness which
>> >> prevents an ENet server from being its own client?
>> >>
>> >> Thanks,
>> >> --Adam
>> >>
>> >>
>> >> _______________________________________________
>> >> ENet-discuss mailing list
>> >> ENet-discuss at cubik.org
>> >> http://lists.cubik.org/mailman/listinfo/enet-discuss
>> >>
>> >>
>> >
>> > _______________________________________________
>> > 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/20131107/093b9fc8/attachment-0001.html
>> >
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Thu, 7 Nov 2013 17:08:56 +0700
>> From: Andrew Fenn <andrewfenn at gmail.com>
>> To: Discussion of the ENet library <enet-discuss at cubik.org>
>> Subject: Re: [ENet-discuss] Connecting to self
>> Message-ID:
>>         <
>> CAKDYWvSdrpd9+AEN4NpirMr170ixh23vLMNa2Sh-S0TrhPvmwg at mail.gmail.com>
>> Content-Type: text/plain; charset=UTF-8
>>
>> I don't have any problems with a running a client / server on the same
>> machine. My code is available here, it's unfinished overall however
>> the enet connection stuff has worked without problems for a long time.
>>
>> https://github.com/andrewfenn/Hardwar
>> Server:
>> https://github.com/andrewfenn/Hardwar/blob/master/code/server/src/Server.cpp
>> Client:
>> https://github.com/andrewfenn/Hardwar/blob/master/code/client/tasks/src/NetworkTask.cpp
>>
>> On Thu, Nov 7, 2013 at 5:00 PM, Ruud van Gaal <ruud at racer.nl> wrote:
>> > All I can say that in principle this works; I use this every day (a
>> single
>> > exe running both and a server and a client, where the client connects
>> to its
>> > own server).
>> > Ruud
>> >
>> >
>> > On Wed, Nov 6, 2013 at 2:37 PM, Krasimir Marinov <krasi at jklsemi.com>
>> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I?ve been trying to connect to the host:port that my ENetHost is bound
>> to,
>> >> i.e. connect and send to myself.
>> >> Unfortunately this almost immediately results in event DISCONNECT.
>> >>
>> >> Looking at the archives I found the same problem raised 9 years ago
>> (see
>> >> below).
>> >>
>> >> Any reason for this behaviour?
>> >>
>> >> Regards,
>> >> Krasimir
>> >>
>> >> [ENet-discuss] Connecting to self.
>> >>
>> >> Adam D. Moss adam at gimp.org
>> >> Wed Dec 1 08:44:30 PST 2004
>> >>
>> >> Next message: [ENet-discuss] Connecting to self.
>> >> Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>> >>
>> >> ________________________________
>> >>
>> >> Hi!
>> >> I have a funny problem.  My app listens on a port and then attempts
>> >> to connect to itself (for testing purposes, for now).  But this
>> >> merely eventually causes a DISCONNECT (presumably time-out) event,
>> >> with no CONNECT.
>> >>
>> >> However, if I launch a second process and do the connect from
>> >> there, the connection is fine.
>> >>
>> >> Am I being stupid for attempting to have a process be a client
>> >> of its own server, or is there some unexpected strangeness which
>> >> prevents an ENet server from being its own client?
>> >>
>> >> Thanks,
>> >> --Adam
>> >>
>> >>
>> >> _______________________________________________
>> >> ENet-discuss mailing list
>> >> ENet-discuss at cubik.org
>> >> http://lists.cubik.org/mailman/listinfo/enet-discuss
>> >>
>> >
>> >
>> > _______________________________________________
>> > ENet-discuss mailing list
>> > ENet-discuss at cubik.org
>> > http://lists.cubik.org/mailman/listinfo/enet-discuss
>> >
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>>
>> End of ENet-discuss Digest, Vol 125, Issue 3
>> ********************************************
>>
>
> _______________________________________________
> 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/20131107/92f81729/attachment-0001.html>


More information about the ENet-discuss mailing list