473,507 Members | 6,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ERROR_OPERATION_ABORTED

I have a system that has multiple serial ports writing to and reading from
each other. Sometimes, I will get an error code 995
(ERROR_OPERATION_ABORTED) while reading. I realize that this means the I/O
operations was aborted due to an existing thread or application request. I'm
not doing either of these to my knowledge. All of this is in one thread
which has a loop to write on all ports then another loop to read all ports.
When I receive the error, the code will still move on to the next port. I
cannot figure out what is causing this, and why it doesn't happen everytime.
I am running on an XP Pro PC. All ports have 9600 baud, which is not
optional, no parity, 1 stop bit.

This is my code if it helps...

bResult = ReadFile(hComm,BufBytes,NumBytes, ref BytesRead,ref ovlCommPort);
if(bResult == false)
{
lLastError = GetLastError();
if(lLastError == ERROR_IO_PENDING)
{
bOverlapResult = GetOverlappedResult(hComm,
ref ovlCommPort,
ref BytesRead, false); //bWait = false
while(bOverlapResult == false)
{
lLastError = GetLastError();
if(lLastError == ERROR_IO_INCOMPLETE)
//normal result if not finished
continue;
else
{
ClearCommError(hComm,
ref
lErrorFlags, ref lpComStat);
break;
}
}
}
else if(lLastError == ERROR_OPERATION_ABORTED)
{
Console.WriteLine("Read: ERROR_OPERATION_ABORTED");
}
}
May 3 '06 #1
0 1412

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

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.