473,396 Members | 1,929 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,396 software developers and data experts.

sockets, select or: twisted and other file-descriptors

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
Jul 18 '05 #1
1 2035
"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.)

-Peter
Jul 18 '05 #2

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

Similar topics

4
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. ...
4
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...
3
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?...
5
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...
3
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,...
6
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...
6
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,...
0
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...
0
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...
3
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.