sockets, select or: twisted and other file-descriptors

D

Diez B. Roggisch

Hi,

I have a simple client-server app, that sits on a serial port and
communicates through that with an attached microcontroller-board. To the
outside, it exposes two sockets (file or inet) which can be connected by
clients to perform certain tasks like uploading programs, giving me a
console and resetting the board. So far, I've used threads - every incoming
connection generates one that will listen to the client socket using
socket.recv. Whatever comes from there is transmitted to the mc-board. The
answer is broadcasted to all listenig clients.

I now want to rewrite it using select and no more threads. If it was only a
network-application, I'd try to make my first steps using twisted. However,
I'm not sure if its possible to have twisteds select also take my
filedescriptors for the serial connection.

I could go for a two-thread approach, or maybe I can overload some twisted
class so that it works on my serial line as if it was a socket connection.

Any suggestions?

Regards,

Diez
 
P

Peter Hansen

Diez B. Roggisch said:
I now want to rewrite it using select and no more threads. If it was only a
network-application, I'd try to make my first steps using twisted. However,
I'm not sure if its possible to have twisteds select also take my
filedescriptors for the serial connection.

Twisted has some (or full?) support for serial ports, so you should
investigate it more closely to see just what it does and whether that
would work for your own application.

A download is free, and you can browse the source pretty easily to
get the gist of it. I suspect you'll see right away that it is or
is not suitable.

(Of course, someone else might be able to say "yeah, it works" or something
already, but there's no real substitute for just checking for yourself.)

-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top