473,721 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IO Serial COM Exception

Hi All,

I write a dll use vb.net 2005 to read data from a serial port and use this
dll in a C# 2005 application. It works well except when I close the port.
After I close the port, sometimes the dll stopped at the readline statement
in data_received function. But the port closed already, why this function is
still fired? ( is it because the delay message? I guess ) I catch the
exception and try to throw a excption, but the dll stopped at the throw
exception statement. This problem is not always there, but sometimes, lets
say 1 of 5. The error message in debug mode is "System.IO.IOEx ception was
unhandled".

Your help are always appreciated
Feb 5 '07 #1
3 2030
Hi,

This (probably) is a problem in the device driver handling the serial port.
I say this because I have seen it with USB serial devices, but not with
internal ports that use physical UARTs instead of the virtual UART that is
furnished by a USB adapter.

You can download DesktopSerialIO .dll for VS2005 from my homepage. I have
tested it with several USB devices, and it (so far) does not have this
problem. Let me know if it works for you. The API that it provides is
similar the SerialPort, but not exactly the same, so you will have to do a
small amount of "porting."

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
Feb 5 '07 #2
Thank you, Richard

Sorry for the late reply.
I'm trying to use your dll; one question, how the CommPort (an Integer)
relate to Serial Port ( a string, COM1, COM2...)?

Rgds,

Taoge
"Dick Grier" <dick_grierNOSP AM@.msn.comwrot e in message
news:uc******** *****@TK2MSFTNG P02.phx.gbl...
Hi,

This (probably) is a problem in the device driver handling the serial
port. I say this because I have seen it with USB serial devices, but not
with internal ports that use physical UARTs instead of the virtual UART
that is furnished by a USB adapter.

You can download DesktopSerialIO .dll for VS2005 from my homepage. I have
tested it with several USB devices, and it (so far) does not have this
problem. Let me know if it works for you. The API that it provides is
similar the SerialPort, but not exactly the same, so you will have to do a
small amount of "porting."

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.

Feb 10 '07 #3
Hi Richard,

Is the InputString same as ReadLine?
If set the PortOpen property to false, is the Port closed and released? Or
should I use dispose to release the port?

Thanks
"Dick Grier" <dick_grierNOSP AM@.msn.comwrot e in message
news:uc******** *****@TK2MSFTNG P02.phx.gbl...
Hi,

This (probably) is a problem in the device driver handling the serial
port. I say this because I have seen it with USB serial devices, but not
with internal ports that use physical UARTs instead of the virtual UART
that is furnished by a USB adapter.

You can download DesktopSerialIO .dll for VS2005 from my homepage. I have
tested it with several USB devices, and it (so far) does not have this
problem. Let me know if it works for you. The API that it provides is
similar the SerialPort, but not exactly the same, so you will have to do a
small amount of "porting."

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.

Feb 10 '07 #4

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

Similar topics

1
5441
by: mimisam | last post by:
hi, I am using Win XP and writing an application to check POS devices (printer and cash drawer).In the application I need to choose the port which the device is connected to. If the port chosen is wrong or the device is off power, a communication error message should be displayed. I am using FileOutputStream and FileInputStream to send and receive data from the ports. When parallel port is used, I got the feedback when the printer is...
0
2483
by: David | last post by:
I am having trouble with "ACCESS DENIED" error messages in a VB.NET 2003 application when attempting to open serial comms ports. The application has 2 ports that connect via serial cable to 2 different hardware devices to transfer binary data to the application. The setup screen enables the user to select COM1 -- COM8 via combo boax for each port. Then they click "Apply" to open the ports. The code that I have written to open the...
4
11050
by: Lonifasiko | last post by:
Hi, I've been able to communicate using HyperTerminal with my device via serial port COM1. I just send a command and device switches on. I just need that to start playing with it. This way, I understand device and serial communication work wihout problems. Now I want to do the same with C# code. As simple as that. I open the serial port with the configuration manufacturer gives me,
5
9495
by: LongBow | last post by:
Hello, Is there a way, in .NET, to determine what are the avialable Serial (Communications) Ports on a Windows OS and is there a way to determine that port isn't being use other than attempting to opening the Serial Port and catching the associated exception? Thanks If there isn't a way to determine the Serial Port within .NET I would be willing, I guess, to use a WinAPI is that was the only way.
2
3957
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the development computer I don't have ay problem with my application.
2
2427
by: Japan Shah | last post by:
Hello, I am trying to connect my Nokia 6610 using usb cable, I have installed usb-serial driver of it. I hv tested it with Hyperterminal and it works fine. but when I wrote a python script I am not able to receive the responce from the device.
4
5445
by: cmdolcet69 | last post by:
This code below write a serial command to the com port then read the results and disaplays it into the label1.text property when button1_click event is triggered. I think what is going on is that the ocp.read is on a timer and reads char by char. How can i change this code so that the read reads the whole result and not char by char? Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
0
4563
by: ghjk | last post by:
I want to read sms from GSM modem using C# in serial communication. I wrote the code. But i want to do it automatically. I put my code here and please tell me how can i do it automatically. public partial class SMS : Form { //create an Serial Port object SerialPort sp = new SerialPort(); public SMS() {
6
6666
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send '%' to serial port and make sure it reached the serial port. 2. Once confirmed, send another character.
2
3152
by: Bassem | last post by:
I'm working on simple chat program via serial port. It works fine, but i face this problem. When i try to open the exe, UnauthorizedAccess exception occurs, i can't use COM1 becuase someone else has it. I checked it and found that another copy of the program still work (by task manager). That's mean closing the program will not close the serial port. I tried these : Note: I read it using a separate thread. 1)override OnClose to, close the...
0
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8730
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9131
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9064
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.