Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2005

Tip: Looking for answers? Try searching our database.

.Net 2.0 B1 Serial port problem?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sam Miller - 12 Apr 2005 02:02 GMT
Anyone had this problem?  It seems IO.Ports.SerialPort generates an "The I/O
operation has been aborted because of either a thread exit or an application
request" exception if you try to close it when it's receiving lots of data.

The following VB.Net console program reliably fails if there's a device
sending full speed serial data at it.  It works fine if the data is being
sent more slowly. (less often)
---------------------------------------------
Imports System.Threading
Imports System.IO.Ports

Module Module1

   Sub Main()
       Dim comPort As System.IO.Ports.SerialPort

       Console.WriteLine("Creating new serial port")
       comPort = New IO.Ports.SerialPort("COM1", 9600, Parity.None, 8,
StopBits.One)

       Console.WriteLine("Opening")
       comPort.Open()

       Thread.Sleep(1000)

       Console.WriteLine("Closing")

       'The following line often fails with: The I/O operation has been
aborted because of either a thread exit or an application request.

       comPort.Close()
End Module
Fethiye Akbulut - 12 Apr 2005 06:02 GMT
Yeah, I think it's broken.

Does the same in C#... but only under load, this produces the same effect
(It's too bad, we realy need serial support):

using System;
using System.IO.Ports;
using System.Threading;

namespace fetserial
{
class Program
{
 static void Main(string[] args)
{
   SerialPort sp = new SerialPort("COM1", 9600, Parity.None, 8,
StopBits.One);
   while (true)
    {
    Console.WriteLine("Test Loop");
    sp.Open();
    Thread.Sleep(1000);
    sp.Close();
    Thread.Sleep(1000);
    }
 }
}
}

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.