473,387 Members | 3,821 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,387 software developers and data experts.

WinIOError on SerialPort on deployment machine only.

Fr33dan
57
Hi,

I've probably given more information than necessary but at this point I'm not sure what is relevant or not.

I have a program that has multiple classes on a single thread making calls to a static instance of SerialPort to communicate with testing hardware (via a Prologix GPIB card but I don't think that's relevant). This static SerialPort instance is managed by a PrologixGPIB class the devices use to interface with it.

This code has been working for months but last week I changed one of the classes to write a double that I called ToString on instead of the hard coded placeholder string. On my development machine this was no problem but on my deployment machine I get the error: "The I/O operation has been aborted because of either a thread exit or an application request."

Here is my SerialPort setup:
Expand|Select|Wrap|Line Numbers
  1. public PrologixGPIB(byte primaryAddress)
  2.         {
  3.             if (sp == null)
  4.             {
  5.                 sp = new SerialPort();
  6.  
  7.                 // COM port parameters
  8.                 ConfigAddress addr = Config.findAddress("GPIB_Controller.DeviceType", "PrologixGPIB");
  9.                 addr.attribute = "Tag";
  10.                 Log.writeLog(log, "Loading Configured Port");
  11.                 sp.PortName = Config.getValue(addr);
  12.                 sp.BaudRate = 115200;
  13.                 sp.DataBits = 8;
  14.                 sp.Parity = Parity.None;
  15.                 sp.StopBits = StopBits.One;
  16.  
  17.                 // RTS/CTS handshaking
  18.                 sp.Handshake = Handshake.RequestToSend;
  19.                 sp.DtrEnable = true;
  20.  
  21.                 sp.WriteTimeout = 10000;
  22.                 sp.ReadTimeout = 10000;
  23.  
  24.                 // Error handling
  25.                 sp.DiscardNull = false;
  26.                 sp.ParityReplace = 0;
  27.                 sp.Open();
  28.  
  29.                 // Sets the prologix GPIB to controller mode.
  30.                 sp.WriteLine("++mode 1");
  31.             }
  32.             this.address = primaryAddress;
  33.  
  34.             setAddress();
  35.  
  36.  
  37.             Log.writeLog(log, "GPIB Configured");
  38.         }
  39.         ~PrologixGPIB()
  40.         {
  41.             if (sp != null)
  42.             {
  43.                 sp.DiscardInBuffer();
  44.                 sp.DiscardOutBuffer();
  45.                 sp.Close();
  46.                 sp = null;
  47.                 Log.writeLog(log, "GPIB Closed");
  48.             }
  49.         }
Write method:
Expand|Select|Wrap|Line Numbers
  1. public override void write(string data)
  2.         {
  3.             try
  4.             {
  5.                 setAddress();
  6.                 Log.writeLog(log, "Writing GPIB Command | " + data);
  7.                 string newData = data;
  8.                 foreach (char c in END_OF_LINE_CHARS)
  9.                 {
  10.                     newData += c;
  11.                 }
  12.                 sp.DiscardInBuffer();
  13.                 sp.Write(newData);
  14.             }
  15.             catch (TimeoutException e)
  16.             {
  17.                 throw new GPIBException("The GPIB write timed out | " + data,e);
  18.             }
  19.         }
Offending code:
Expand|Select|Wrap|Line Numbers
  1. public override void setGateTime(string time)
  2.         {
  3.             this.write("GATE" + time);
  4.         }
  5.  
  6.         public override void setGateTime(double time)
  7.         {
  8.             this.setGateTime(time.ToString("##.###"));
  9.         }
In my searching I've discovered that this error can be caused by having an improperly closed SerialPort but the error happens every time right after the computer is booted and the SerialPort hasn't been touched.

EDIT: Forgot to mention the dev machine is running Windows XP SP3 and the deployment machine is Windows 2000 SPwhatever the last was
Jun 13 '11 #1
0 1214

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chucker | last post by:
Hi Folks, I got an Auto-Updating Application that is supposed to download all the assemblies needed from a deployment machine when started. Here ist the Code for the Launcher that has to be...
2
by: Mark | last post by:
Hi, I've been having problems with the validation controls not working on my deployment server. Initially it was a security issue with the anonymous account not having permissions to access...
3
by: Chuck P | last post by:
I need to deploy and asp.net 2.0 application that has dpapi/machine encrypted connection strings. I tried using the VS Build Publish menu selection and then putting the encryption in the...
3
by: Jiro Hidaka | last post by:
Hello my manager has a question in regards to being able to give access to a file to a computer only. This file will be either sent to or downloaded from the client computer. For example we are a...
2
by: Chris | last post by:
We are making the move to an asp.net three-tier architecture. Ease of deployment is a big factor. One thing that confuses me is deployment. XCOPY should be enough. If I have a DAL, BAL and a...
0
by: nmsreddi | last post by:
Hi friends I am working on serialport in c# ,i am using C#2005 i have successfully done the serial communication with GSM modem and able to send and receive data , the main problem ,the serial...
7
pod
by: pod | last post by:
Hello My OS is Windows2000 I am new to .NET I developed a C# Windows Application that connects to a MS Access database on the network using proper UNC format. It works perfectly on my...
2
by: Dmenace | last post by:
Microsoft blows my mind sometimes, what the hell were they thinking? Oh, wait they weren't, that's right. Anyway, I've got a Setup and Deployment added to my project, and it does everything I...
8
by: Tim Zych | last post by:
Stumped here. When I access a ComClass enabled library in Excel on the development machine, it works fine. When I install the app on another machine, and try to access it, I get an error: ...
2
by: Sam T | last post by:
Delving into SCPI commands and DTR/DSR communications. I have worked my problem down to some nuance. I am using C# Express 08 on Win XPSP2. My code does this: { create, set, and open serialport;...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.