Page 1 of 1

Socket problem with love-11.1

Posted: Sat May 19, 2018 10:12 am
by zyp568
I code a program using love-0.10.2, and it worked fine.
I updated love-0.10.2 to love-11.1 a few days ago, and then I got a problem with tcp server, I just can NOT connected to tcp server in the program.
When I turn 11.1 to 0.10.2, the problem just gone, everything worked fine.
So, there may be a bug in love-11.1, or something different between 0.10.2 and 11.1 ?
Please help me, thanks a lot.

Re: Socket problem with love-11.1

Posted: Sat May 19, 2018 1:52 pm
by Beelz
Check that your firewall isn't blocking v11. Other than that, it's hard to give a better answer with such little information.

Re: Socket problem with love-11.1

Posted: Sat May 19, 2018 8:03 pm
by 4aiman
You may want to check the IP you're running server at.
In 0.10.x days I could easily start a server with a loopback IP while attempting to establish connection to a local IP. And that worked.
In 11.x it's impossible to connect to LAN IP if you ran server on a loopback IP.
If that's the case, then just use "*" as the server address.
Cheers.

Re: Socket problem with love-11.1

Posted: Sun May 20, 2018 11:40 am
by zyp568
Thanks a lot.
Here are the code for setting up TCP-Server :

Code: Select all

    o.server = Socket.tcp()
    o.server:settimeout(0)
    -- local res, err = o.server:bind('*', 5688)
    local res, err = o.server:bind('10.32.24.60', 5688)
    if (res == nil) then error(err) end
    o.server:listen(1)
MacOSX-10.13.4 + Love-0.10.2 :

Code: Select all

    o.server:bind('*', 5688)            --  'getsockname()' got '0.0.0.0' as ip.
    o.server:bind('10.32.24.60', 5688)  --  'getsockname()' got '10.32.24.60' as ip.
MacOSX-10.13.4 + Love-11.1 :

Code: Select all

    o.server:bind('*', 5688)            --  'getsockname()' got a ':' as ip.
    o.server:bind('10.32.24.60', 5688)  --  'getsockname()' got '10.32.24.60' as ip.
So, if I do NOT know the host ip, how can I configure the server ip in my program using love-11.1 ?

Re: Socket problem with love-11.1

Posted: Sun May 20, 2018 11:51 am
by bartbes
You can force binding to ipv4 instead of ipv6 by passing "0.0.0.0" as local ip. But binding to ipv6 usually doesn't mean ipv6-only...

Re: Socket problem with love-11.1

Posted: Sun May 20, 2018 3:13 pm
by zyp568
Thanks a lot, it is working fine now.