connection reffused

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
LuLove
Prole
Posts: 2
Joined: Sun Jul 22, 2018 2:18 pm

connection reffused

Post by LuLove »

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?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: connection reffused

Post by zorg »

Hi and welcome to the forums.

Have you tried "127.0.0.1" as the host?
Me and my stuff :3True 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.
User avatar
Мэтю
Prole
Posts: 32
Joined: Mon Jan 06, 2014 1:24 pm
Location: Espírito Santo, Brazil
Contact:

Re: connection reffused

Post by Мэтю »

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.
LuLove
Prole
Posts: 2
Joined: Sun Jul 22, 2018 2:18 pm

Re: connection reffused

Post by LuLove »

Мэтю wrote: Mon Jul 23, 2018 2:24 pm 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
I'm sorry. Indeed, I was just trying to connect through different ports between them
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests