473,405 Members | 2,210 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,405 software developers and data experts.

network server threading

I've got a: "start server thread > Queue object, start server thread <>
Queue object, start parsing client < Queue object" application that's
got me puzzled. Probably an easy threads issue, but after digging thru
Programming Python and Python Recipes sections on Threading class and
running thru the examples, I'm still missing something.

My Server/Server/Client app is a syslog collector app (syslog input in,
zope control web interface to manage ala start/stop/status, and BEEPy
out) - two servers and one client app that has got me somewhat puzzled
per how to handle with threads. The app:

1. read in config file
2. launch a syslog server to listen on port 514, taking input and
putting it into a database-persistent Queue (I'm using BDB's DB_QUEUE
implemented in a class Logfile which I've created to allow me to:

l = Logfile(db_filename, db_recsize) ## BSD DB's Queue has a fixed
record length limitation which gets set by db.set_re_len

and then

l.push("Syslog data.....")
l.push("More syslog data...")

as well as l.pop(), l.hasrec() and l.size() methods to control
the Queue.

3. runs a test message to see if I've launched the first server and am
ready to do more work (this is where the second server and client will
come in once I'm crawling along).

The problem I run into is that I'm apparently not threading the syslog
server and returning control to my app:

class Syslogd(ThreadingUDPServer, InterruptibleServer):

is based on:
http://www.drbeat.li/pycgi/webutil.p...syslogd.py.txt
with modifications to reference my Berkeley DB Queue, instead of
displaying to sys.stdout.write. So far, so good - I'm logging and
writing to the database (though it appears to be committing on the
db.close() rather than writes, but that's another issue I'll have to
deal with via the BSD DB C/Java docs since the Python docs on it's Queue
method are limited - I've looked at ZODB for this as well).

Here's where I get into trouble, and as mentioned at the beginning, is
probably just a lack of me getting threads:

if __name__ == '__main__':

try:
log = Logfile('syslog.db',255) # create BSD DB Queue object
syslogd = Syslogd(log, timefmt='%H:%M:%S') #create syslog object
syslogd.serve() #start serving syslog input on port
print "This is a test"
except KeyboardInterrupt:
print "Closing queue database..."
log.close()
print "Operation canceled by user."
I never get to the test print, as once I'm in syslog.serve(), I'm there
until I quit. Maybe I'm missing the logic here completely - if I want to
share access to Logfile between syslogd object and two other objects, am
I on the wrong track?

Eventually, after threading syslog.serve(), I need to do the same with
the Zope HTTP service (which allows control to the application, much
like HTTP to a Linksys router for status, configuration, start, stop
functions), and also launching the BEEPy parsing of data from the Queue
which gets passed onto a database upstream. Talking BEEP is a must due
to the firewalls involved, so no distributed object approach will help
here. A "syslogd in, dump to queue backed by database in case device
gets shut off before it can parse and send, and a parse & send via BEEP
engine" model.

Maybe there's a better example out there of:
1. start server dumping to a shared object
2. start another server accessing a shared object
3. start a client processing the shared object

model someone is aware of - ala Queue?

Thanks much...

Jamie
"So much to learn, so little caffeine!"
Jul 18 '05 #1
0 1853

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

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
11
by: Parahat Melayev | last post by:
Hi I am programming a multi-threaded asyncronous server with .NET But when systems thread count reaches to 1350 system can't respond. Simply my design is creating a Reading Thread after...
0
by: bob | last post by:
I have a somewhat complex question about how Threading works across the network. Below is the full source code of a program that will list any file modified on myServer. When I run this code from...
1
by: Frosty Madness | last post by:
I have the beginnings of a device emulator that sits on the network... ************** using System; using System.Threading; using System.Net; using System.Net.Sockets; using System.Text;
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
1
by: Andrew | last post by:
Hello Everyone I am receiving an error in an application I am working on. The application when its done will be a Dungeons and Dragons Network game. I am having problems with the Networked...
0
by: janefield2002 | last post by:
Hi there, I get the following error using Access ODBC drivers: '(unknown)' is not a valid path. make sure that the path name is spelled correctly and you are connected to the server on which...
0
by: SyGC | last post by:
Hi Guys, I have used Threading for Network.Ping to continuously ping an IP address if ping is successful Image A is displayed if not Image B. The code is as follows: Imports System Imports...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.