472,374 Members | 1,156 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

sockets, select or: twisted and other file-descriptors


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?


Jul 18 '05 #1
1 1995
"Diez B. Roggisch" wrote:

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.)

Jul 18 '05 #2

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

Similar topics

by: Julia Goolia | last post by:
hello, i read that it is bad to use threads with tkinter. so my question is how does one create a gui program with sockets? at one point you have to call mainloop() which does not return. ...
by: jblazi | last post by:
I am having this problem: I use Python for my teaching and right now we are trying to implement some sort of very simple graphical game the pupils can play across the Internet. For this, we use...
by: Ajay | last post by:
hi! how can i stop a server socket running in a thread other than the main thread? if the server socket was a local variable of the function started by the child thread, would calling join work?...
by: zxo102 | last post by:
Hi, I am doing a small project using socket server and thread in python. This is first time for me to use socket and thread things. Here is my case. I have 20 socket clients. Each client send a...
by: OneMustFall | last post by:
Reciently i wrote a simple client (in twisted) using Reconnecting Factory. That client logins to my socket server.. and that`s it. Interesting thing is that it is seems that twisted client,...
by: Maxim Veksler | last post by:
Hi, I've written this code, the general idea was to listen on all 65535 port of tcp for connection. """ #!/usr/bin/env python import socket, select def...
by: geoffbache | last post by:
Hi all, I have a Python program (on UNIX) whose main job is to listen on a socket, for which I use the SocketServer module. However, I would also like it to be sensitive to signals received,...
by: huisan.wang | last post by:
Hello everyone, I am writing a program with twisted and dbus and got a such problem. If i run the code as $python local_proxy.py There is an error like this: Traceback (most recent call...
by: James Mills | last post by:
On Fri, Sep 19, 2008 at 6:24 AM, Fredrik Lundh <fredrik@pythonware.comwrote: There is also one more alternative: pymills - current version 3.4 It has a different design goal to twisted and...
by: Daniel | last post by:
Hello, I can't seem to get my sockets code to work right. Here is what I have inside my RequestHandler handle() function: total_data= data = True...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.