[ENet-discuss] Connecting to self

Krasimir Marinov krasi at jklsemi.com
Thu Nov 7 02:45:02 PST 2013


The code that you shared connects peers from 2 different ENetHosts.

The pseudocode that I showed

    ENetAddress address;
    a.host = <localhost>
    a.port = <port>

    EnetHost *host = enet_host_create(&address, .....);
    enet_host_connect(host, &address, ...);

tries to connect the host to itself. Notice that there is only one address
and one host!



On Thu, Nov 7, 2013 at 12:08 PM, Andrew Fenn <andrewfenn at gmail.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20131107/e20fe8b1/attachment.html>


More information about the ENet-discuss mailing list