A problem with Sock.lua library

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
User avatar
SkippyDip
Prole
Posts: 3
Joined: Thu Oct 10, 2019 7:40 pm

A problem with Sock.lua library

Post by SkippyDip » Thu Oct 10, 2019 7:59 pm

Hi, I have this problem that might sound stupid but I've been stuck with it for a long while now.
I am using a library called Sock.lua (https://github.com/camchenry/sock.lua) and I have a problem with public host/self-hosting

Code: Select all

server = sock.newServer("IP HERE", 22122)
What IP do I use? I tried my public IP and it gave this error:
Failed to create the host. is there another server running on 22122?
I can local-host fine but I can't public-host..
Please help, thx. :awesome:

User avatar
raidho36
Party member
Posts: 1931
Joined: Mon Jun 17, 2013 12:00 pm

Re: A problem with Sock.lua library

Post by raidho36 » Thu Oct 10, 2019 11:30 pm

Address indicates on which IP the server is going to run. You usually want to use asterisk ( "*" ) or "localhost" for server IP when you create it.

User avatar
pgimeno
Party member
Posts: 1885
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

Re: A problem with Sock.lua library

Post by pgimeno » Fri Oct 11, 2019 9:20 am

"*" fails with some libraries on some systems. 0.0.0.0 should work fine across platforms. localhost is not guaranteed to work for anything other than your own computer.

User avatar
SkippyDip
Prole
Posts: 3
Joined: Thu Oct 10, 2019 7:40 pm

Re: A problem with Sock.lua library

Post by SkippyDip » Fri Oct 11, 2019 10:54 am

But I wanna make it so people around the world can connect to the server/IP, I don't want to localhost.

User avatar
pgimeno
Party member
Posts: 1885
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

Re: A problem with Sock.lua library

Post by pgimeno » Fri Oct 11, 2019 10:58 am

Use 0.0.0.0

User avatar
SkippyDip
Prole
Posts: 3
Joined: Thu Oct 10, 2019 7:40 pm

Re: A problem with Sock.lua library

Post by SkippyDip » Fri Oct 11, 2019 10:59 am

Okay, thank you so much for the help.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 13 guests