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, <[email protected]> wrote: > Send ENet-discuss mailing list submissions to > [email protected] > > 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 > [email protected] > > You can reach the person managing the list at > [email protected] > > 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 <[email protected]> > To: Discussion of the ENet library <[email protected]> > Subject: Re: [ENet-discuss] Connecting to self > Message-ID: > <CAF9Sf24JhcW9ka9BHVObj36oaX9Nna=XXTvSpbH= > [email protected]> > 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 <[email protected]> > 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 > > [email protected] > > 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 <[email protected]> > To: Discussion of the ENet library <[email protected]> > Subject: Re: [ENet-discuss] Connecting to self > Message-ID: > <CADULfbPHZZvt=+ > [email protected]> > 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 <[email protected]> > 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 > > [email protected] > > 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 <[email protected]> > To: Discussion of the ENet library <[email protected]> > Subject: Re: [ENet-discuss] Connecting to self > Message-ID: > <CA+M1DxdvZNTxXv-Z= > [email protected]> > 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 <[email protected]> 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 <[email protected] > >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 > >> [email protected] > >> http://lists.cubik.org/mailman/listinfo/enet-discuss > >> > >> > > > > _______________________________________________ > > ENet-discuss mailing list > > [email protected] > > 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 <[email protected]> > To: Discussion of the ENet library <[email protected]> > Subject: Re: [ENet-discuss] Connecting to self > Message-ID: > < > cakdywvsdrpd9+aen4npirmr170ixh23vlmna2sh-s0trhpv...@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 <[email protected]> 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 <[email protected]> > 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 > >> [email protected] > >> http://lists.cubik.org/mailman/listinfo/enet-discuss > >> > > > > > > _______________________________________________ > > ENet-discuss mailing list > > [email protected] > > http://lists.cubik.org/mailman/listinfo/enet-discuss > > > > > ------------------------------ > > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss > > > End of ENet-discuss Digest, Vol 125, Issue 3 > ******************************************** >
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
