473,378 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

IRC bot threading dilemma

Hello,

I have coded an IRC bot in Python. Each inbound packet is parsed, and
once the bot decides whether it is a command directed at the bot or
not, it will either
discard the packet or make a function call to an access control
checker function. If the invoking user is found to have sufficient
access to run this command, another function call is made. This
function call depends on what command the user in question has
invoked.

Try to imagine making one of these functions send out a WHOIS query to
the server, and wait for the burst of WHOIS-response packets from it.
How would this function wait? Yes, I know, I am going to have to
create another thread to loop while it waits for this reply packet.
The problem is, I can't simply tell my command function to loop until
the "waiter thread" raises a flag to say that it has received the
packet. During this looping time, program flow would be stuck here,
thus preventing the bot from replying to any vital duties such as
"pingponging" (server verifies that you are still there by sending
"PING" and expects a "PONG" in return.)

For this reason I was thinking: do you think I should run a new thread
whenever a new command is invoked by a user? And have the thread
delete itself when it's completed execution? This way the bot would
*always* be free to do its duties.

Any help is much appreciated.

M. Baker
Jan 18 '08 #1
0 910

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pete | last post by:
I'm developing an open source CMS, but have come across a problem. The system dynamically creates .php files for the front-end of the site, meaning they're owned by user 'nobody'. However, for...
1
by: Miha | last post by:
hi to everyone... could someone mail me a sample source code of the spatial prisoner's dilemma game...application code,not applet...thanx in advance mihael.sedmak@fer.hr
2
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
12
by: Thomas Matthews | last post by:
Hi, According to Robert Martin's Dependency Inversion Principle, http://www.objectmentor.com/resources/articles/dip.pdf, when there is a need to test the type of an object, the code inside the...
2
by: rb531 | last post by:
Guys, I am struck up with a dilemma whether to use threading or delgates for asynchronous processing. Can anyone throw some light on this? Please let me know which one is better. Thanks
1
by: mark | last post by:
I have a form 2 which contains a datagrid. In form 1 I have a procedure - "PopulateC" which populates it with values. The instance of form 2 is "Matrix_C" and it is global. I determine the data...
16
by: hzmonte | last post by:
Correct me if I am wrong, declaring formal parameters of functions as const, if they should not be/is not changed, has 2 benefits; 1. It tells the program that calls this function that the...
4
by: igd | last post by:
I am forced to decorate my .NET Main()-method with , since an unmanaged function (which i am calling through P/Invoke) calls CoCreateInstance() in turn. The problem is, that another unmanaged...
2
by: John Rogers | last post by:
I have some code that does a recursive copy of whatever folder I give to it to copy the structure where I want it. I have it running in a single thread to make it a bit more efficient. So far it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.