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?
connection reffused
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: connection reffused
Hi and welcome to the forums.
Have you tried "127.0.0.1" as the host?
Have you tried "127.0.0.1" as the host?
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: connection reffused
Silly question: Are you at least running a server at this port? You only wrote the client part, which connects to a server. If no server is running on the port of your desire then the connection will be refused
World needs love.
Re: connection reffused
I'm sorry. Indeed, I was just trying to connect through different ports between them
Who is online
Users browsing this forum: Semrush [Bot] and 6 guests