What operating system are you running? Did you try running as administrator/root?Sir_Silver wrote: ↑Fri Jun 16, 2017 4:54 am Yes, the minimum amount of code needed to cause the error is this:
where my_ip_here is a string that is my public ip address.Code: Select all
local sock = require("lib/networking/sock") local server = sock.newServer(my_ip_here, 27015)
sock.lua - A simple networking library for LÖVE
Re: sock.lua - A simple networking library for LÖVE
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: sock.lua - A simple networking library for LÖVE
It would be awesome if you could provide a simple example of its usage, like making a box move
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: sock.lua - A simple networking library for LÖVE
He has examples of it's usage on the github page.
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: sock.lua - A simple networking library for LÖVE
It's a sample on its basic usage, but not a sample about implementing it in a very simple game.
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: sock.lua - A simple networking library for LÖVE
yetneverdone wrote: ↑Wed Jun 21, 2017 5:30 amIt's a sample on its basic usage, but not a sample about implementing it in a very simple game.
No? https://github.com/camchenry/sock.lua/t ... mples/pong
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: sock.lua - A simple networking library for LÖVE
Oh a pong sample, sorry i didn't see that.Sir_Silver wrote: ↑Wed Jun 21, 2017 12:33 pmyetneverdone wrote: ↑Wed Jun 21, 2017 5:30 amIt's a sample on its basic usage, but not a sample about implementing it in a very simple game.
No? https://github.com/camchenry/sock.lua/t ... mples/pong
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: sock.lua - A simple networking library for LÖVE
How can I handle a invalid host name?.
Code: Select all
Class = require('libs.hump.class')
Play = Class{}
function Play:myGames()
return 'https://indrajith.dev'
end
Re: sock.lua - A simple networking library for LÖVE
OK
My scenario is this :
Suppose I started a server @ 192.168.0.100:22122. But I'm trying to connect a server @ 192.168.0.100:2000 or may be the IP I put caused an typo error. How can I handle this.
server
Code: Select all
function love.load()
server = sock.newServer("192.168.0.100", 22122) -- The port here is 22122
.....
.....
end
Code: Select all
function love.load()
client = sock.newClient("192.168.0.100", 2000) -- The port here is 2000, this can be another IP
.....
.....
end
Code: Select all
Class = require('libs.hump.class')
Play = Class{}
function Play:myGames()
return 'https://indrajith.dev'
end
Re: sock.lua - A simple networking library for LÖVE
It sounds like you want to use xpcall (https://www.lua.org/manual/5.2/manual.html#pdf-xpcall) to handle the error. NOTE: I have linked the Lua 5.2 docs for xpcall. Lua 5.1 does not support passing arguments through xpcall, but 5.2 does and LuaJIT (which LÖVE runs on) has ported this feature.
Hopefully this gets you close to what you want.
Code: Select all
local function handleError(err)
print("Error: " .. err)
return err
end
local ok, result = xpcall(sock.newClient, handleError, "192.168.0.1", 12345)
if ok then
-- do something with client
local client = result
else
-- do something with error
local err = result
end
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 5 guests