🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Even driven application

Started by
1 comment, last by WitchLord 16 years, 10 months ago
I'm looking for some design ideas: I have an application which is an IDE (for AS of course). The user can write scripts and run them (debug as well) inside the IDE. The purpose for the application is to emulate client/servers (mainly SIP/HTTP), and it is event driven. The programmer defines some callbacks ("void onRequest(request@)" for example), and the application will call it when a request is received. Here is a demo script: class Sip : IRequest // IRequest is a predefined interface { void onRequest(request@ r) { } } sip_udp_server server; void main() { server.listen(5060,"Sip"); // Use "Sip" type for callbacks } This should create a UDP server on port 5060, and call Sip::onRequest for every incoming request. The listener is asynchronous and there are no additional threads (only a single thread for the main application - GUI. Windows only). Now, after the long intro, here is the problem: The main window has a member variable of the running context. When the user start the script, it create a context, start the "main" function and waits for events. Let's assume the user put a breakpoint inside the onRequest callback. When I have a breakpoint, I simply call "Suspend" on the context, and resume when the user wants to continue (continue,step in,step over). My problem is when there will be ANOTHER incoming request, while the user is debugging a callback. Since there will already be an active context, I don't want to reset it. In additional, if I'll create a new context, it won't be recognized by the debugging window. I hope I was clear enough. Any ideas on what to do? - Gilad
Advertisement
I've solved it.

I've implemented a queue with messages. The socket posts the packets into the queue, and I read a packets from there - thus I have more control on when to handle the data.
Sounds like a good solution.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement