Socket problem with love-11.1

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
zyp568
Prole
Posts: 3
Joined: Sat May 19, 2018 9:55 am
Location: Nanjing, China
Contact:

Socket problem with love-11.1

Post 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.
User avatar
Beelz
Party member
Posts: 234
Joined: Thu Sep 24, 2015 1:05 pm
Location: New York, USA
Contact:

Re: Socket problem with love-11.1

Post 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.

Code: Select all

if self:hasBeer() then self:drink()
else self:getBeer() end
GitHub -- Website
User avatar
4aiman
Party member
Posts: 262
Joined: Sat Jan 16, 2016 10:30 am

Re: Socket problem with love-11.1

Post 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.
zyp568
Prole
Posts: 3
Joined: Sat May 19, 2018 9:55 am
Location: Nanjing, China
Contact:

Re: Socket problem with love-11.1

Post 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 ?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Socket problem with love-11.1

Post 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...
zyp568
Prole
Posts: 3
Joined: Sat May 19, 2018 9:55 am
Location: Nanjing, China
Contact:

Re: Socket problem with love-11.1

Post by zyp568 »

Thanks a lot, it is working fine now.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 40 guests