Serial Port: The I/O operation has been aborted...

S

shaish

Hey all, I am using a serial port (RS232) to read/write data to an
external device and Im using the SerialPort class.

I have a serious problem I dont really understand.
Every other time I call the ports Open/Close methods I get an
System.IO.IOException:
"The I/O operation has been aborted because of either a thread exit or
an application request"
Can somebody please explain to me what does it mean and more
importantly why does it happen and what should I do to resolve this ?

A few things that might help:
-The external device is constantly sending the host data at a high
rate.
-Like I said the exception is thrown about every second call I make to
the open/close methods.
-I've tried calling the open/close methods through the GUI (after a
button click), tried creating a special thread for the task and tried
calling the methods through in the Main() method. Got the same
behavior in all cases...

Thank you !

If it helps here are the exception full details:

System.IO.IOException was unhandled
Message="The I/O operation has been aborted because of either a
thread exit or an application request.\r\n"
Source="System"
StackTrace:
at System.IO.Ports.InternalResources.WinIOError(Int32
errorCode, String str)
at System.IO.Ports.SerialStream.BeginReadCore(Byte[] array,
Int32 offset, Int32 numBytes, AsyncCallback userCallback, Object
stateObject)
at System.IO.Ports.SerialStream.Read(Byte[] array, Int32
offset, Int32 count, Int32 timeout)
at System.IO.Ports.SerialStream.Read(Byte[] array, Int32
offset, Int32 count)
at System.IO.Ports.SerialPort.Read(Byte[] buffer, Int32 offset,
Int32 count)
at Smartech.Rs232Module._port_DataReceived(Object sender,
SerialDataReceivedEventArgs e) in C:\Documents and Settings\Shai
\Desktop\Projects\Orsense\SmartechCommon\Rs232.cs:line 325
at System.IO.Ports.SerialPort.CatchReceivedEvents(Object src,
SerialDataReceivedEventArgs e)
at
System.IO.Ports.SerialStream.EventLoopRunner.CallReceiveEvents(Object
state)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context
(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at
System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal
(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback
(Object state)
InnerException:
 

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

Top