I have been trying to make an irc client with love2d as a fun project of mine, and it works... well sorta.
It connects to the irc server absolutely fine, but it receives nothing!
local username = "USERNAME"
local nickname = "Username"
local ip = "irc.freenode.net"
local port = "6667"
local channel = "#(ARealWorkingChannel)"
local irc = socket.tcp()
print(irc:connect(ip,tonumber(port)))
irc:settimeout(1)
irc:send("USER "..username.." 8 * :"..username.."\r\n")
irc:send("NICK "..nickname.."\r\n")
irc:send("JOIN "..channel.."\r\n")
--to help get a better understanding of how irc works:
function love.update(dt)
print(irc:receive())
end
My IRC bot connects to Freenode through the port 6667, I don't think Freenode accepts connections on other ports
EDIT: Just tested your code, setting the port to 6667 fixes it for me. Also, storing it as string and only using it with tonumber is quite useless, you might want to store it as number directly
Last edited by Nixola on Mon Dec 30, 2013 6:50 pm, edited 1 time in total.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
That's a weird issue then. Can you try to download my bot and see if it works? To run it, you can cd into its directory and run "lua main.lua"; it could work with Love, I think, even if the window would look unresponsive
Edit: I just noticed something, setting the timeout to 0 is a bad idea unless you need nonblocking network operations. If you let LuaSocket wait until it receives a message you'll save a lot of CPU cycles which would go wasted otherwise.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics