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

resume TCP comunication

Hi,

I'am writing a program to cotrol a machine. I use socket comunication
(TCP) to do it.
I do a measurement in my machine like this:

def DoMeasurement():
setup1()
setup2()
while MeasurementNotFinished():
move()
measure()
finalizeMeasurement()
Each funciton setup1, setup2, move,mesure, ... call a method in a class
that contains a socket that do the comunication staff

class DiSock(socekt):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def comunicate(self):
self.sock.sendall(Request.struct2string())

msg = ''
MSGLEN = 608
while len(msg) < MSGLEN:
chunk = self.sock.recv(MSGLEN-len(msg))
if chunk == '':
raise RuntimeError,"socket connection broken"
msg = msg + chunk
data = msg
Answer.string2struct(data)
Request and Anser are objects in where i put the information i whant to
send and recive from the
machine.

All the measurement is done in a new thread.

The problem is that sometimes i loose the conenction whith the
machines. In the case a ConnectionFailure exception is raised. How can
i do resume the Measurement when the conection is resumed? Can i use a
yield for this?

Thanks in advance

Zunbeltz

Nov 28 '05 #1
0 1065

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

Similar topics

6
by: Zunbeltz Izaola | last post by:
Hi, I have the following problem. I'm developing a GUI program (wxPython). This program has to comunicate (TCP) whit other program that controls a laboratory machine to do a measurement. I...
2
by: Ian DeRock | last post by:
I'm fairly new to XML. As I can see it, XML is a way to organize data like in a table in a RDB, or the RDB itself. I have used XML in application data, but did not design the actual XML. I...
2
by: Darta | last post by:
OK- I volunteer to be shot if this question is stupid... BUT, is there a way to, when you catch an exception in the catch{} handler, resume to the same line of code that generated an error while...
3
by: bob.needler | last post by:
I know On Error Resume Next is generally considered lazy. But can someone tell me why the resume next in Exit_Handler does not seem to work? It generates the typical unhandled runtime error...
11
by: Olie | last post by:
This post is realy to get some opinions on the best way of getting fast comunication between multiple applications. I have scowered the web for imformation on this subject and have just found...
2
by: findyasir | last post by:
Hi all, I am having problem comunication with serial port in linux. I have tested the serial port with attaching a serial modem and dialing the numbers with wvdial. it works okie but when i...
7
by: fniles | last post by:
In VB 6.0 in the error trapping, we can do "resume next" to continue on the next code. How can we do that in .NET with "Try", "Catch","End Try" ? Thanks
0
MMcCarthy
by: MMcCarthy | last post by:
Organizing a Resume Pertinent information included on your resume may be organized in a variety of ways. Regardless of the type of resume used, you should include the following: Contact...
2
by: vhm | last post by:
Hi all, I have to debug a hardware that comunicate with the computer through a USB conection. I know that the harware present some problem when the driver send some type of command to it. I'll like...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.