Realtime programming..../me pains

Right... so I've been playing around with some real time programming, tbh i think this is going to be a pain in the ass :(
This evening I started working on a communications system so I can parse information from one system, the user input AJAX stuff, to the server, which runs 4evr in an while(true) loop, and I have the basic stuff working. You'll probably notice I used the word basic, and boi do I mean t3h basics :D I'm basically spamming a file using file_put_contents :D go Iain for creative usage of PHP /me dances and to read the file :O I'm using file_get_contents /me faints.....


Right I really should start taking this seriously, someone out there on gods green earth might be reading this, and if you are I'm sorry, for what I'm not 100% but sorry none the less :)
The plan is to use a simple text document to keep a record of user inputs, as the system is real time I needed a method of feeding my while(true) loop with information, which it in turn will use to change the world.
The next task is to allow the inputted information to make changes to the world, and as a start I'm going to write a chat client/server, I think i may have said this before, but that’s the point of blogging, to waste you the readers time with mindless words :D /me out.
02:01 PM | 1 Comment

Comments

  1. Sounds like you need some kind of action queue. Server queues up actions on an outgoing queue to send to client until it can pop them out and push them to the client. Client pushes messages to the server, which get added to an incoming queue 9either for entire server or per-user depending on which you want to code) until while loop can process. So in a chat client, client sends message to incoming queue. While loop sees that the incoming queue has an item, processes it, adds a new action to the outgoing queue for the recipient user. Action is sent to recipient when their queue is polled, message displayed on screen. 'tis what I did with my degree project :D
    mark.james on