sock can't connect

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
togFox
Party member
Posts: 764
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

sock can't connect

Post by togFox »

So I use sock.lua after trying enet and socket and probably other libraries I've forgotten and sock.lua is both very well documented and easy to use and it works out of the box - if you're on a LAN.

I can't get an external internet client to connect to the host. I think I've done port forwarding correctly. I've determined my local IP (192.168.x.x) and port expected by the game and set that up in my router IP address for TCP and UDP. I could have got that wrong but I've checked every single option in the router admin window and exhausted all windows/options so I'm going to assume I got that bit right.

For the code - it works on LAN very well. A client can connect to 192.168.x.x with the required port and that works very well. sock.lua is fantastic this way. I just can't get an external host to connect. I use WHATISMYIP to get something like 526.154.x.x and give that to the client. Frustratingly, sock.lua gives no error message.

Here is the hosting code:

Code: Select all

server = Sock.newServer("*", 22122)
I've also read on some forum and tried this unsuccessfully

Code: Select all

server = Sock.newServer("0.0.0.0", 22122)

This is the client code:

Code: Select all

client = Sock.newClient(GAME_SETTINGS.hostIP, tonumber(GAME_SETTINGS.hostPort))
They type in 526.154.x.x and the port and wait and nothing happens. No error. No connection.

I feel I am --> <-- this far away from publishing my game so kinda jumping out of my skin to crack this one.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Lua Developer and 19 guests