LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Well, I'm making an IRC client, and have messages going back and forth so thats good.
But my problem is that to constantly check for messages received from the server, I'm using something like this:
repeat forever with messages
-check for messages-
wait 3 milliseconds with messages
end repead
Is there a better way to be constantly doing something? This crashes often, and I usually have to abort it before I can even add anything to the stack.
Thanks.
on readFromSocket theIP,theMsg
if theMsg is "makes sense" then
read from socket theIP with message "readFromSocket"
else
-- stop
end if
end readFromSocket
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Actually, does this constantly read from the socket?
It seems to be a just a function to me. I already can read from the socket, but I need to figure out how to do that constantly without an infinite loop.
Thanks,
Patrick
In this example, the handler will continue to call itself as long as theMsg is "makes sense". Not a very realistic example, but it makes clear how it works.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Probably you do something wrong
Keep in mind that I made an example. A complete set of scripts takes much more than just that. Are you sure you have set up all scripts of both the server and the client stack correctly?
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Well, using your example I made another test stack that simply put something into a text field after your function had been called. I attempted to start it with a button that both read from a socket, and called the function directly. However, it had no results.
Look around in this forum for more examples. Spend a few hours figuring out how to do it. Download examples from RevOnline and elsewhere. Once you have a complete set of scripts for both the server and the client and if it still doesn't work, then you might want to post your scripts here and we can tell you what is wrong. Keep it as simple as possible in the beginning.
Good luck,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode