Hey hope some like to help :)
I try to make a socket script there connect to irc server, need to be online all the time.
My script works as lua script.lua but then i run it whit px it make px not responde.
some of the code:
-- Run main loop
while true do
local l = s:receive()
--some code
end
Hope someone can help or say it not will work
You are creating never ending loop in script, so PtokaX is blocked by that script and can't work ::)
Yes :D
But how to make a socket connection then ?
the connection need to be open all the time....
Create socket, connect to server and then on timer (for example every second) try to read or send data on that socket (basically that is how PtokaX works) :P
ok thanks :)
I have a another script there download a file whit socket, if it take longtime it not response too.
Have you any ide for that ?
I use timeout in one script but in this i need the file...
It is always same. Create socket, connect socket, set it nonblocking (or zero timeout with select) and then in some intervals try to read/write. Never do loops on read/writes ::)
Ok I will look in to it :)
Thanks for you help and time PPK
It works almost now :)
First time it find/write it dont respone in some time and then post it. :(
i dont understand this:
set it nonblocking (or zero timeout with select)
It is in luasocket docs :P
QuoteChanges the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods send, receive, and accept will block indefinitely, until the operation completes. The settimeout method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
Looks like real non-blocking is always not supported, so low (zero ?) timeout is needed ::)
Thanks agen PPK :)
Now i only have some text problems hehe :)
1 (1-15) need to remove them