connection reffused
Posted: Sun Jul 22, 2018 2:29 pm
Hello! I'm trying to create a client-server application. I have a question on luasocket. I connect the socket = require ("socket") library and write the code:
function Backgammon: rand ()
host = "localhost"
port = 28005
c = assert (socket.connect (host, port))
return c: receive ()
end
The interpreter returns an error: "connection reffused".
If I write like this:
function Backgammon: rand ()
host = "localhost"
port = 28005
if arg then
host = arg [1] or host
port = arg [2] or port
end
c = assert (socket.connect (host, port))
return c: receive ()
end
The interpreter returns an error: "host of service not provided, or not know"
How to connect?
function Backgammon: rand ()
host = "localhost"
port = 28005
c = assert (socket.connect (host, port))
return c: receive ()
end
The interpreter returns an error: "connection reffused".
If I write like this:
function Backgammon: rand ()
host = "localhost"
port = 28005
if arg then
host = arg [1] or host
port = arg [2] or port
end
c = assert (socket.connect (host, port))
return c: receive ()
end
The interpreter returns an error: "host of service not provided, or not know"
How to connect?